Description
Describe the bug
- If you are reporting a bug, please help to speed up problem diagnosis by providing as
much information as possible: - A clear and concise description of what the bug is: the title of an issue is not enough
A: I'm using Springdoc to document my API, but for any reason, all endpoints include a 404 response status, even if I don't add it explicitly.
To Reproduce
Steps to reproduce the behavior:
-
What version of spring-boot you are using?
A: I'm using version
3.2.5
of Spring Boot -
What modules and versions of springdoc-openapi are you using?
A: I'm using version
2.5.0
from the module modulespringdoc-openapi-starter-webmvc-ui
of Springdoc -
What is the actual and the expected result using OpenAPI Description (yml or json)?
-
Provide with a sample code (HelloController) or Test that reproduces the problem
A: For configuring Springdoc:
@Configuration public class OpenApiConfig { @Bean protected OpenAPI openAPI() { final Info info = new Info() .description("Description") .title("Name") .version("1.0.0"); final SecurityScheme jwtHeaderSecurityScheme = new SecurityScheme() .bearerFormat("JWT") .in(SecurityScheme.In.HEADER) .name("AuthToken") .scheme("bearer") .type(SecurityScheme.Type.HTTP); final Components components = new Components().addSecuritySchemes( "AuthToken", jwtHeaderSecurityScheme ); return new OpenAPI() .components(components) .info(info); } }
And the controller:
@RequestMapping("/hello") @RequiredArgsConstructor @RestController @Tag( description = "Hello operations", name = "Hello" ) public class HelloController { @ApiResponse( content = { @Content( schema = @Schema( type = "string" ) ) }, description = "Send greetings.", responseCode = "200" ) @Operation( description = "Send greetings.", summary = "Send greetings" ) @GetMapping() public String getAvatarImage() { return "Hello world!"; } }
By the way, you can find a real life example here.
Expected behavior
- A clear and concise description of what you expected to happen.
- What is the expected result using OpenAPI Description (yml or json)?
A: I expected Springdoc to only add the response status that I explicitly add.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.