Forum Discussion

sam2011's avatar
sam2011
New Member
3 years ago

Conditionally enable/disable swagger documentation for endpoints based on environment.

Team,

In our springboot project, we use springdoc-openapi for generating swagger documentation for controller endpoints.

Currently Swagger documentation from the server application gets populated once controller have the endpoint available.

This does not necessarily mean it’s available to be consumed by client or api consumer.

We have several endpoints that are available in controller, but not yet ready for client consumption.

So we are looking for options on how we can enable/disable swagger documentation for certain endpoints based on the spring profile (dev/uat/prod)

Could you please help me find a solution for this?

  • hashanm's avatar
    hashanm
    Occasional Visitor

    I am facing the same issue, I also need to disable the specification in prod env.