swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.61k stars 8.96k forks source link

How to show only specific tags in Swagger UI? #10143

Open chirag1807 opened 2 months ago

chirag1807 commented 2 months ago

How can we help?

I have a Swagger UI setup with multiple tags in my OpenAPI specification, and I want to customize the UI to display only certain tags for each operation.

For example, in my spec file, I have the following path:

"paths": {
    "/v1/resource": {
      "post": {
        "description": "summary: Add Resource",
        "produces": [
          "application/json"
        ],
        "tags": [
          "v1",
          "resource"
        ],
        "operationId": "AddResource1"
      }
    }
  }

I want to display only the "resource" tag in the Swagger UI and hide the "v1" tag.

How can I achieve this? Is there a way to filter out tags programmatically in the Swagger UI configuration? @char0n

heldersepu commented 1 month ago

this should not be the job of the UI... I imagine that you can create a plugin that does that, but... whatever generates that specification should do that filtering/removal job