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

fix(licenses): Update Response for api single license and add rest api docs create License #2167

Merged

Conversation

tuannn2
Copy link
Contributor

@tuannn2 tuannn2 commented Nov 1, 2023

feature:

  • Update response for API single License
  • Add rest docs for API Create License

How To Test?

  • Run command line:
$ curl 'https://sw360.org/api/licenses/Apache-2.0' -i -X GET \
    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic3czNjAtUkVTVC1BUEkiXSwidXNlcl9uYW1lIjoiYWRtaW5Ac3czNjAub3JnIiwic2NvcGUiOlsiYWxsIl0sImV4cCI6MTY5ODgyODgyNCwiYXV0aG9yaXRpZXMiOlsiUkVBRCIsIldSSVRFIl0sImp0aSI6Inh4Z1RBZ2pIcUFfZkpuS3EwVmkxQXVFS0ZIZyIsImNsaWVudF9pZCI6InRydXN0ZWQtc3czNjAtY2xpZW50In0.e6mw__gXV5fsQ4GkcG-RIlKjywvkbczCmG7czqTU6j5w5fHgreUtXOTjwl0hdDudpPLR--hNP2TZgGL-abPz2cYO2xj3LHd3uQcBeOwcfawo7MxcZY8T0xIzbqhqtkNusMXc8bEGf9B5OHiGSLEvDVE8E1J7ItyYyoVEnezW-d9ODJ9EVzAqpPTPS2ipqUfSZKDWTSOg8srJAE6Qy2Ig7JPYQK6MzAPbK5YbkAhbvR5KHY3e3s-ZW_1HTO3iftnMqvtDIj7VrGfFFsaSE8R2KiVv04AauL9ePh7dRj6m_KxtryygEv9GnKSwtoUrbimDP-zCU_QPHmV9mn0WevQWDw' \
    -H 'Accept: application/hal+json'

  • Response:
{
  "externalLicenseLink" : "https://spdx.org/licenses/Apache-2.0.html",
  "note" : "License's Note",
  "externalIds" : {
    "Trove" : "License :: OSI Approved :: Apache Software License",
    "SPDX" : "Apache-2.0"
  },
  "additionalData" : {
    "Key" : "Value"
  },
  "OSIApproved" : "NA",
  "FSFLibre" : "NA",
  "obligations" : [ {
    "type" : "obligation",
    "text" : "This is text of Obligation 1",
    "title" : "Obligation 1",
    "obligationLevel" : "LICENSE_OBLIGATION",
    "obligationType" : "PERMISSION"
  }, {
    "type" : "obligation",
    "text" : "This is text of Obligation 2",
    "title" : "Obligation 2",
    "obligationLevel" : "LICENSE_OBLIGATION",
    "obligationType" : "OBLIGATION"
  } ],
  "obligationDatabaseIds" : [ "0002", "0001" ],
  "text" : "placeholder for the Apache 2.0 license text",
  "checked" : true,
  "shortName" : "Apache 2.0",
  "fullName" : "Apache License 2.0",
  "_links" : {
    "self" : {
      "href" : "https://sw360.org/api/licenses/Apache-2.0"
    }
  },
  "_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"
        }
      }
    } ]
  }
}

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 Nov 1, 2023
@KoukiHama KoukiHama requested a review from ag4ums November 2, 2023 14:47
@nikkuma7
Copy link
Contributor

nikkuma7 commented Nov 3, 2023

Test successful.

image

@rudra-superrr rudra-superrr removed the needs general test This is general testing, meaning that there is no org specific issue to check for label Nov 7, 2023
@rudra-superrr
Copy link
Contributor

Hi @tuannn2 , as I can see obligations data is coming twice in your response structure, any specific reason for this?
My suggestion would be to add "type" and "obligationLevel" to the embedded structure of obligations and remove the obligations field from response in order to prevent redundancy OR just remove the embedded structure of obligations..

…s api create license

Signed-off-by: tuannn2 <tuan2.nguyennhu@toshiba.co.jp>
@tuannn2 tuannn2 force-pushed the release/update_response_single_release branch from 8a7dcc6 to 4e329b4 Compare November 7, 2023 08:49
@tuannn2
Copy link
Contributor Author

tuannn2 commented Nov 7, 2023

Hi @tuannn2 , as I can see obligations data is coming twice in your response structure, any specific reason for this? My suggestion would be to add "type" and "obligationLevel" to the embedded structure of obligations and remove the obligations field from response in order to prevent redundancy OR just remove the embedded structure of obligations..

Thank you for your comment, @rudra-superrr.
Because, I need id of obligation, so I removed the obligations field from response.

@rudra-superrr
Copy link
Contributor

Code looks good.

@rudra-superrr rudra-superrr added ready ready to merge and removed needs code review labels Nov 7, 2023
@ag4ums ag4ums merged commit 4efed92 into eclipse-sw360:main Nov 8, 2023
1 check 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.

5 participants