Search code examples
spring-bootswaggeropenapispringdoc

How to get the Swagger schema for a specific version of a Swagger API?


I know I can add a /v3/api-docs/ to the end of my APIs endpoint to get a JSON representation of my APIs schema.

Is there a way to get the schema for a specific version of the API?


Solution

  • In our case, we have a versioned API.

    The below URI was our entire JSON schema including all API versions.

    .../v3/api-docs
    

    But, the below URI was scoped only to a specific API version.

    .../v3/api-docs/v2-tool
    

    The v2-tool corresponds to a namespace specific to our code.