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
In my specific scenario, I would like to use springdoc so that my spring-boot application has swagger-ui nicely integrated, but I need to provide my own (manually created) OpenAPI definition file.
Describe the solution you'd like
I want to add the openapi.json file to my src/main/resources folder and set a springdoc property (a path to that file) so that /v3/api-docs endpoint returns my definition file for swagger-ui without any additional config. In other words, I want to override the automatically generated definition (so that the swagger-ui endpoint will return my file).
Describe alternatives you've considered
Adding a /v3/api-docs file to my src/main/resources/static files, so spring responds with it but it does not work as expected since spring will not set a proper content-type header (seems rather hacky)
Additional context
Having a generated file in the repository allows me to review changes reflected in openapi definition or I can use GithubApp that will do some validation/standardization on PR touching such file.
Do you think this feature request is valid?
Would you be ok with such feature added?
The text was updated successfully, but these errors were encountered:
bgalek
changed the title
Option to use static openapi definition file
An option to use static openapi definition file from resources instead of generated one
Mar 4, 2025
@bnasslahsen Thank you for the reply. I tried this approach, but it requires some boilerplate code in my whole org (hundreds of repositories). This property springdoc.swagger-ui.url changes where the swagger frontend looks for the definition - instead - I'm looking for a way of changing the content of the existing endpoint - if that feature existed, I would not need to set an additional endpoint in my applications. We force each application (via k8s configmap) to serve their openapi on the same path - so we can scan it periodically and have a standard. I'm ok if you don't like this feature; just at least give it a thought :)
In my specific scenario, I would like to use
springdoc
so that my spring-boot application hasswagger-ui
nicely integrated, but I need to provide my own (manually created) OpenAPI definition file.Describe the solution you'd like
I want to add the
openapi.json
file to mysrc/main/resources
folder and set a springdoc property (a path to that file) so that/v3/api-docs
endpoint returns my definition file forswagger-ui
without any additional config. In other words, I want to override the automatically generated definition (so that the swagger-ui endpoint will return my file).Describe alternatives you've considered
/v3/api-docs
file to mysrc/main/resources/static
files, so spring responds with it but it does not work as expected since spring will not set a proper content-type header (seems rather hacky)Additional context
Having a generated file in the repository allows me to review changes reflected in openapi definition or I can use GithubApp that will do some validation/standardization on PR touching such file.
Do you think this feature request is valid?
Would you be ok with such feature added?
The text was updated successfully, but these errors were encountered: