Skip to content

Commit e9b2b68

Browse files
Updated mediaTypes for error responses
1 parent 0da539a commit e9b2b68

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/com/answerdigital/answerking/controller/ProductController.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public ResponseEntity<List<Product>> getAllProducts() {
5454
@ApiResponse(responseCode = "200", description = "When the product with the provided id has been found.",
5555
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) }),
5656
@ApiResponse(responseCode = "404", description = "When the product with the given id does not exist.",
57-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) })
57+
content = { @Content(mediaType = "application/problem+json", schema = @Schema(implementation = ErrorResponse.class)) })
5858
})
5959
@GetMapping(path = "/{id}")
6060
public ResponseEntity<Product> getProductById(@Valid @PathVariable @NotNull final Long id) {
@@ -66,7 +66,7 @@ public ResponseEntity<Product> getProductById(@Valid @PathVariable @NotNull fina
6666
@ApiResponse(responseCode = "201", description = "When the product has been created.",
6767
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) }),
6868
@ApiResponse(responseCode = "400", description = "When invalid parameters are provided.",
69-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) })
69+
content = { @Content(mediaType = "application/problem+json", schema = @Schema(implementation = ErrorResponse.class)) })
7070
})
7171
@PostMapping
7272
public ResponseEntity<Product> addProduct(@Valid @RequestBody final ProductRequest productRequest) {
@@ -78,9 +78,9 @@ public ResponseEntity<Product> addProduct(@Valid @RequestBody final ProductReque
7878
@ApiResponse(responseCode = "200", description = "When the product has been updated.",
7979
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) }),
8080
@ApiResponse(responseCode = "400", description = "When invalid parameters are provided.",
81-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) }),
81+
content = { @Content(mediaType = "application/problem+json", schema = @Schema(implementation = ErrorResponse.class)) }),
8282
@ApiResponse(responseCode = "404", description = "When the product with the given id does not exist.",
83-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) })
83+
content = { @Content(mediaType = "application/problem+json", schema = @Schema(implementation = ErrorResponse.class)) })
8484
})
8585
@PutMapping("/{id}")
8686
public ResponseEntity<Product> updateProduct(@PathVariable @NotNull final Long id,
@@ -93,9 +93,9 @@ public ResponseEntity<Product> updateProduct(@PathVariable @NotNull final Long i
9393
@ApiResponse(responseCode = "200", description = "When the product has been retired.",
9494
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) }),
9595
@ApiResponse(responseCode = "404", description = "When the product with the given id does not exist.",
96-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) }),
96+
content = { @Content(mediaType = "application/problem+json", schema = @Schema(implementation = ErrorResponse.class)) }),
9797
@ApiResponse(responseCode = "410", description = "When the product with the given id is already retired.",
98-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) })
98+
content = { @Content(mediaType = "application/problem+json", schema = @Schema(implementation = ErrorResponse.class)) })
9999
})
100100
@DeleteMapping("/{id}")
101101
public ResponseEntity<Product> retireProduct(@PathVariable @NotNull final Long id) {

0 commit comments

Comments
 (0)