I'm using SpringBoot with the following dependency
<dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>1.5.12</version> </dependency>
The controller class (@RestController) has one entry point (@GetMapping), and this entry point should return a List of the object : MyClass.java. I added Swagger annotations above the method in order to create API documentation via a swagger UI page.
The swagger documentation should indicate that the return object is of type
List< MyClass>
But how should I do that ? If I do
"@Schema(implementation = List< MyClass >.class)"
there is a compile error.
Swagger annotations:
@Operation(....) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ????)) }), @ApiResponse(...), @ApiResponse(...) @GetMapping(value = "/aaa", produces = MediaType.APPLICATION_JSON_VALUE) public List<MyClass> getAaa(...) { return ... }