Skip to content

Ability to disable swagger-ui default petstore url #714

Closed
@alfonz19

Description

@alfonz19

We are deploying to production environment. If someone opens default swagger page without configUrl specified, it's completely NOT ok, to display some playground petstore app.

by setting property( is placeholder):

springdoc.swagger-ui.configUrl=/<contextPath>/v3/api-docs

I'd expect that this configUrl will be opened if configUrl is not present in URL, however it seems, that if I put this configuration here, I won't be able to use url:

http://localhost:8080/<contextPath>/swagger-ui/index.html?configUrl=/<contextPath>/v3/api-docs

and will get PetStore undesirable even for this URL. Either I'm misreading documentation or this is a bug.

Regardless of that — I understand, that this behavior goes back to swagger_ui and their targetting of their product for non-prod environment. The web/stackoverflow/... provides examples how to block this behavior, but the suggestions are rather ridiculous(rebuilding swagger), or not appliable (because requires javascript customization of swagger). Can you suggest correct solution? I don't want to see any possibility to reach PetStore nonsense or any other config other than what we provided on our URL. If someone wants to use PetStore app, he can surely do it elsewhere. Currently we have to do it via spring resource transformer just to force swagger to good behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions