Search code examples
swaggerswagger-uiswagger-2.0

Can Swagger have different security for different tags?


Can Swagger have different security for different tags? I can't find the setting for tag's security in the Swagger Specification.

I hope the same tag will own the same security, and different tags will own different security.

I know paths can set their own security, but it's a little inconvenient.


Solution

  • No.

    security can be set either globally or in individual operations (GET/POST/etc.), with the operation-level security overriding the global security.

    Refer to the specification to see what is supported and what's not:
    https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md