I am new to swagger and using it's documentation. I am currently trying to use swagger to display the request body of a PATCH request. Previously, the parameter of the PATCH method was the DTO of the object that was being updated, which made it very easy to display the attributes of the object (as I am using SpringBoot, and using @Schema
worked perfectly). However, now the parameter of the PATCH method is an HttpServletRequest. Instead of displaying the HttpServletRequest in the swagger doc (which seems to automatically be happening), I want to show the DTOs attributes (just as had been done before). I was wondering if there was a way to do that?
Any advice is much appreciated!
The above answer did not work since adding another parameter to the method broke the functionality of the method itself.
The solution that worked was in the controller to add the content parameter to the @RequestBody
annotation:
@RequestBody(description = "Description.",
content = @Content(schema = @Schema(implementation = ObjectDTO.class)));