Skip to content

Commit a146da5

Browse files
committed
BENCH-181 json ignore tags removed
1 parent aae2abc commit a146da5

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public ProductController(final ProductService productService) {
4343
@Operation(summary = "Get all products.")
4444
@ApiResponses(value = {
4545
@ApiResponse(responseCode = "200", description = "When all the products have been returned.",
46-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) })
46+
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ProductResponse.class)) })
4747
})
4848
@GetMapping
4949
public ResponseEntity<List<ProductResponse>> getAllProducts() {
@@ -54,7 +54,7 @@ public ResponseEntity<List<ProductResponse>> getAllProducts() {
5454
@Operation(summary = "Get a single product.")
5555
@ApiResponses(value = {
5656
@ApiResponse(responseCode = "200", description = "When the product with the provided id has been found.",
57-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) }),
57+
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ProductResponse.class)) }),
5858
@ApiResponse(responseCode = "404", description = "When the product with the given id does not exist.",
5959
content = { @Content(mediaType = "application/problem+json",
6060
schema = @Schema(implementation = ErrorResponse.class)) })
@@ -67,7 +67,7 @@ public ResponseEntity<ProductResponse> getProductById(@Valid @PathVariable @NotN
6767
@Operation(summary = "Create a new product.")
6868
@ApiResponses(value = {
6969
@ApiResponse(responseCode = "201", description = "When the product has been created.",
70-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) }),
70+
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ProductResponse.class)) }),
7171
@ApiResponse(responseCode = "400", description = "When invalid parameters are provided.",
7272
content = { @Content(mediaType = "application/problem+json",
7373
schema = @Schema(implementation = ErrorResponse.class)) })
@@ -80,7 +80,7 @@ public ResponseEntity<ProductResponse> addProduct(@Valid @RequestBody final Prod
8080
@Operation(summary = "Update an existing product.")
8181
@ApiResponses(value = {
8282
@ApiResponse(responseCode = "200", description = "When the product has been updated.",
83-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) }),
83+
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ProductResponse.class)) }),
8484
@ApiResponse(responseCode = "400", description = "When invalid parameters are provided.",
8585
content = { @Content(mediaType = "application/problem+json",
8686
schema = @Schema(implementation = ErrorResponse.class)) }),
@@ -97,7 +97,7 @@ public ResponseEntity<ProductResponse> updateProduct(@PathVariable @NotNull fina
9797
@Operation(summary = "Retire an existing product.")
9898
@ApiResponses(value = {
9999
@ApiResponse(responseCode = "200", description = "When the product has been retired.",
100-
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = Product.class)) }),
100+
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ProductResponse.class)) }),
101101
@ApiResponse(responseCode = "404", description = "When the product with the given id does not exist.",
102102
content = { @Content(mediaType = "application/problem+json",
103103
schema = @Schema(implementation = ErrorResponse.class)) }),

src/main/java/com/answerdigital/answerking/model/Product.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
public class Product {
3939
@Id
4040
@GeneratedValue(strategy = GenerationType.IDENTITY)
41-
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
4241
private Long id;
4342

4443
private String name;
@@ -50,12 +49,10 @@ public class Product {
5049

5150
private boolean retired;
5251

53-
@JsonIgnore
5452
@ManyToMany(fetch = FetchType.EAGER, mappedBy = "products")
5553
private Set<Category> categories = new HashSet<>();
5654

5755
@OneToMany(mappedBy = "product", cascade = CascadeType.ALL)
58-
@JsonIgnore
5956
private Set<LineItem> lineItems = new HashSet<>();
6057

6158
public Product(final String name, final String description, final BigDecimal price, final boolean isRetired) {

src/main/java/com/answerdigital/answerking/response/ProductResponse.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public class ProductResponse {
2323

2424
private BigDecimal price;
2525

26-
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
2726
private List<Long> categories;
2827

2928
private boolean retired;

0 commit comments

Comments
 (0)