Skip to content

Overwrite server URLs for static/custom OpenAPI Specs #3033

Open
@coiouhkc

Description

@coiouhkc

Is your feature request related to a problem? Please describe.

When using static/custom OpenAPI Spec to be the source for the Swagger UI, one currently doesn't seem to have a possibility to overwrite the server URL (which is not known at the design/spec phase of writing the spec and is subject to change based on the deployment/ target env).

See e.g. https://quarkus.io/guides/openapi-swaggerui#quarkus-smallrye-openapi_quarkus-smallrye-openapi-servers

Describe the solution you'd like

I'd like to have an option to overwrite the server URL(s) in the custom statically served OpenAPI Spec.

One possible solution (which I implemented as a workaround in current project) would be to use an interceptor doing a preHandle on the springdoc.swagger-ui.url and given that it's set and called replaces the server(s) portion of the static/custom OpenAPI Spec with contents of the newly added property springdoc.swagger-ui.serverUrl(s).

Describe alternatives you've considered

Additional context

  • if this feature request gets accepted, happy to work on a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions