You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to declare two @SecurityScheme on my REST API. Declaring either @SecurityScheme works fine (I see a "securitySchemes" node in the spec), but declaring both inside a @SecuritySchemes does not work
Modify ./src/main/java/com/quicksign/springdoc/security/multiplesecurityrequirements/OpenApiConfiguration.java (comment the single security declaration, uncomment the multiple security declaration), and restart the application
Check that two declarations don't work by doing curl -s http://localhost:8080/v3/api-docs | jq ".components"
Well, in fact it's highly recommended to declare OpenAPIDefinition with a spring managed bean (for example by adding @Component annotation).
By using a spring managed bean, it works as expected!
The main reason is to improve the performance of the OpenAPI generation, so that springdoc-openapi doesn't have to scan all the class path, for classes containing this annotation.
This is explained in the documentation.
But, i agree, that what you are reporting is a bug. Even, without using spring beans, the generation should be consistent.
Describe the bug
@SecurityScheme
on my REST API. Declaring either@SecurityScheme
works fine (I see a "securitySchemes" node in the spec), but declaring both inside a@SecuritySchemes
does not workTo Reproduce
Steps to reproduce the behavior:
./gradlew bootRun
curl -s http://localhost:8080/v3/api-docs | jq ".components"
./src/main/java/com/quicksign/springdoc/security/multiplesecurityrequirements/OpenApiConfiguration.java
(comment the single security declaration, uncomment the multiple security declaration), and restart the applicationcurl -s http://localhost:8080/v3/api-docs | jq ".components"
Expected behavior
Screenshots
N/A
Additional context
This seems to have been reported already with #249 which was closed as "works for me", hence the reproducer :)
The text was updated successfully, but these errors were encountered: