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(Package): Can't create a new Package by API #2134

Merged

Conversation

tuannn2
Copy link
Contributor

@tuannn2 tuannn2 commented Oct 4, 2023

Please provide a summary of your changes here.

  • Which issue is this pull request belonging to and how is it solving it? (Refer to issue here)
  • Did you add or update any new dependencies that are required for your change?

Issue: #2066 (comment)

Suggest Reviewer

You can suggest reviewers here with an @mention.

How To Test?

  • Execute API create new Package:
$ curl 'https://sw360.org/api/packages' -i -X POST \
    -H 'Content-Type: application/hal+json' \
    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic3czNjAtUkVTVC1BUEkiXSwidXNlcl9uYW1lIjoiYWRtaW5Ac3czNjAub3JnIiwic2NvcGUiOlsiYWxsIl0sImV4cCI6MTY5NjQxOTA5NSwiYXV0aG9yaXRpZXMiOlsiUkVBRCIsIldSSVRFIl0sImp0aSI6IkJWRm1XLVE2eGYyMHpHWkFCSFFKVlVyXzBrbyIsImNsaWVudF9pZCI6InRydXN0ZWQtc3czNjAtY2xpZW50In0.cczk58GFFfBI2nmtelGrBKfzbZ1rUB1ZswVHzq-8g4x7VTUtA3j5oLBwPaGld68uoLojmG0qtwqnpD8hzX0x9XkXHJz9JrbSkdpPJNuxj8GSZ0bddb2bK_W6t5kRXcTq6TRb5Q8y7n-mpceTDDKEpFP9e4WGwPlCqmB_IRLfoMnigWZwEROvDjUKA_2tGQhxcoieJjnL1GJSCxsqNAuMg88WcL1UNjXw8do-b0p_1tvUv3TBKe5fAHeYr_jKalrcU3URZDuNP6A4OvgP2XBy2WHnyARFSZ8HA661DAWz5fPynJn3SafOGPQSpHAtFSKznabnq5UnjmB4wj2UQGlNFw' \
    -d '{
  "name" : "angular-sanitize",
  "version" : "1.8.2",
  "packageType" : "FRAMEWORK",
  "purl" : "pkg:npm/[email protected]",
  "vcs" : "git+https://github.com/angular/angular.js.git",
  "homepageUrl" : "https://github.com/angular/angular-sanitize",
  "licenseIds" : [ "GPL", "MIT" ],
  "description" : "Sanitizes a html string by stripping all potentially dangerous tokens.",
  "packageManager" : "NPM",
}'
  • Expected response:
{
  "name" : "angular-sanitize",
  "version" : "1.8.2",
  "purl" : "pkg:npm/[email protected]",
  "packageType" : "FRAMEWORK",
  "licenseIds" : [ "GPL", "MIT" ],
  "description" : "Sanitizes an html string by stripping all potentially dangerous tokens.",
  "homepageUrl" : "http://angularjs.org",
  "vcs" : "git+https://github.com/angular/angular.js.git",
  "createdOn" : "2023-01-02",
  "packageManager" : "NPM",
  "_links" : {
    "self" : {
      "href" : "https://sw360.org/api/packages/122357345"
    }
  },
  "_embedded" : {
    "sw360:release" : {
      "name" : "Test Release",
      "version" : "2",
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/releases/98745"
        }
      }
    },
    "createdBy" : {
      "email" : "[email protected]",
      "deactivated" : false,
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/users/byid/123456789"
        }
      }
    }
  }
}

Checklist

Must:

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

@afsahsyeda
Copy link
Contributor

Code looks good to me.

@KoukiHama KoukiHama added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for REST and removed needs code review labels Oct 5, 2023
@KoukiHama
Copy link
Member

it works fine

@KoukiHama KoukiHama added ready ready to merge and removed needs general test This is general testing, meaning that there is no org specific issue to check for labels Oct 11, 2023
@ag4ums ag4ums merged commit 4a45c71 into eclipse-sw360:main Oct 11, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ready to merge REST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants