Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(license): Listing obligations by license #2234

Merged

Conversation

tuannn2
Copy link
Contributor

@tuannn2 tuannn2 commented Dec 12, 2023

Add new API Listing obligations by license

How To Test?

  • Run command
$ curl 'https://sw360.org/api/licenses/MIT/obligations' -i -X GET \
    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic3czNjAtUkVTVC1BUEkiXSwidXNlcl9uYW1lIjoiYWRtaW5Ac3czNjAub3JnIiwic2NvcGUiOlsiYWxsIl0sImV4cCI6MTcwMjM1MjAyNSwiYXV0aG9yaXRpZXMiOlsiUkVBRCIsIldSSVRFIl0sImp0aSI6IkxxSGFjbU5QVThlcWlEMnNpVTFlWGZ3bHB3USIsImNsaWVudF9pZCI6InRydXN0ZWQtc3czNjAtY2xpZW50In0.gadnfJIwnx4D2a77wXBkZCUKldzOTnQNul4v2slHSkAePjTe7HqA4ktRQ4UoWWeb_7XRy2kvfZIEkc4MmiN7mIxKIB2PYNPHyPiDy6EO9VJPO5_TqWfdXGOagGuefHowXNLeB54W7N-42kD5OLgh_xgx0CXV7mi7m2fs32ysnwQWR2B0xUC_CAIqp9PZQJK062KW01tec2c6vM8_yeNZTP4y4NKw-jqe9LpH8flpzxOtX8O7iVkqcZ4rFwcl6vouSZ5YLL7Ru6Kh-NOmvmHosHyCUT6LHbiSyid4kKNK8Ja_mK1CdMDWmTa76ua59OJC-PbTbmv4pkhVll6QNh2RFQ' \
    -H 'Accept: application/hal+json'
  • Output
{
  "_embedded" : {
    "sw360:obligations" : [ {
      "text" : "This is text of Obligation 1",
      "title" : "Obligation 1",
      "obligationType" : "PERMISSION",
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/obligations/0001"
        }
      }
    }, {
      "text" : "This is text of Obligation 2",
      "title" : "Obligation 2",
      "obligationType" : "OBLIGATION",
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/obligations/0002"
        }
      }
    } ]
  },
  "_links" : {
    "curies" : [ {
      "href" : "https://sw360.org/docs/{rel}.html",
      "name" : "sw360",
      "templated" : true
    } ]
  }
}

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

@tienlee tienlee added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for REST New-UI Level for the API and UI level changes for the new-ui labels Dec 12, 2023
@akshitjoshii
Copy link
Contributor

akshitjoshii commented Jan 2, 2024

Testing was successful
2024-01-02 10_58_43-

),
responseFields(
subsectionWithPath("_embedded.sw360:obligations[]title").description("The title of the obligation"),
subsectionWithPath("_embedded.sw360:obligations[]obligationType").description("The obligationType of the obligation"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be "The type of the obligation" or "Obligation type" instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@@ -849,6 +849,12 @@ public List<Obligation> getObligationsByIds(Collection<String> ids) {
return obligations;
}

public List<Obligation> getObligationsByLicenseId(String id) throws SW360Exception {
License license = getLicenseForOrganisation(id, "?");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the usage of passing "?" as the organization?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit confused. Thanks.

@tuannn2 tuannn2 force-pushed the release/listing_obligations_by_license branch from c49eed3 to 83a2b3a Compare January 3, 2024 07:01
@afsahsyeda
Copy link
Contributor

Changes look good to me.

@afsahsyeda afsahsyeda added ready ready to merge and removed needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Jan 3, 2024
@ag4ums ag4ums merged commit 2c94e21 into eclipse-sw360:main Jan 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New-UI Level for the API and UI level changes for the new-ui ready ready to merge REST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants