This is a bit weird. springdoc-openapi-ui v1.2.32, the generated docs contain only a few of the mappings within a controller.
Example:
@Operation(
summary = "Foo",
description = "Foo"
)
@PostMapping(path="/v1/foo")
public ResponseEntity<ResponseObject> postFoo(@RequestBody FooRequestObject searchRequest, HttpServletRequest request){ ... }
@Operation(
summary = "Bar",
description = "Bar"
)
@GetMapping(path="/v1")
public ResponseEntity<ResponseObject> getBar(@RequestBody BarRequestObject request, HttpServletRequest request){ ... }
@Operation(
summary = "Bar",
description = "Bar"
)
@PostMapping(path="/v1")
public ResponseEntity<ResponseObject> postBar(@RequestBody BarRequestObject request, HttpServletRequest request){ ... }
Docs are generated only for postBar
and getBar
services, the other path is ignored.
What I've tried:
- Originally both POST methods were named
post
. I renamed to avoid conflict. - I am not setting a controller level path.
- Checked annotation imports
- Not hitting a cached version of the doc
If I add another service to the controller (with or without the annotation tag), it also does not show in the generated Swagger. For example:
@GetMapping(path="/test")
public String getTest(){
return "test";
}
If I add this method to a brand new controller, doc is generated.
Thanks
Edit Config class
@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI springOpenAPI() {
return new OpenAPI()
.info(new Info().title("My API")
.description("My API service documentation. ")
.version("v1.0")
.license(new License().name("Terms of Use").url("https://myapi.com/terms.html")));
}
}