Skip to content

Commit f15ccd7

Browse files
sameed20GMishx
authored andcommitted
feat(rest): standardize POST response to include created entity ID
Signed-off-by: Sameed <sameed.ahmad@siemens-healthineers.com>
1 parent 6ba3bf6 commit f15ccd7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/JacksonCustomizations.java

-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@ static abstract class ComponentMixin extends Component {
643643

644644
@JsonInclude(JsonInclude.Include.NON_NULL)
645645
@JsonIgnoreProperties(value = {
646-
"id",
647646
"revision",
648647
"type",
649648
"licenseIdsSize",

rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/PackageSpecTest.java

+4
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ public void should_document_get_packages_with_all_details() throws Exception {
236236
linkWithRel("last").description("Link to last page")
237237
),
238238
responseFields(
239+
fieldWithPath("_embedded.sw360:packages.[]id").description("The id of the package"),
239240
fieldWithPath("_embedded.sw360:packages.[]name").description("The name of the package"),
240241
fieldWithPath("_embedded.sw360:packages.[]version").description("The version of the package"),
241242
fieldWithPath("_embedded.sw360:packages.[]packageType").description("The package type, possible values are: " + Arrays.asList(CycloneDxComponentType.values())),
@@ -270,6 +271,7 @@ public void should_document_get_package() throws Exception {
270271
linkWithRel("self").description("The <<resources-packages,Packages resource>>")
271272
),
272273
responseFields(
274+
fieldWithPath("id").description("The id of the package"),
273275
fieldWithPath("name").description("The name of the package"),
274276
fieldWithPath("version").description("The version of the package"),
275277
fieldWithPath("packageType").description("The package type, possible values are: " + Arrays.asList(CycloneDxComponentType.values())),
@@ -403,6 +405,7 @@ public void should_document_create_package() throws Exception {
403405
fieldWithPath("description").description("Description of the package")
404406
),
405407
responseFields(
408+
fieldWithPath("id").description("The id of the package"),
406409
fieldWithPath("name").description("The name of the package"),
407410
fieldWithPath("version").description("The version of the package"),
408411
fieldWithPath("packageType").description("The package type, possible values are: " + Arrays.asList(CycloneDxComponentType.values())),
@@ -437,6 +440,7 @@ public void should_document_update_package() throws Exception {
437440
fieldWithPath("description").description("Description of the package")
438441
),
439442
responseFields(
443+
fieldWithPath("id").description("The id of the package"),
440444
fieldWithPath("name").description("The name of the package"),
441445
fieldWithPath("version").description("The version of the package"),
442446
fieldWithPath("packageType").description("The package type, possible values are: " + Arrays.asList(CycloneDxComponentType.values())),

0 commit comments

Comments
 (0)