utoipa icon indicating copy to clipboard operation
utoipa copied to clipboard

SecurityScheme: Logical OR for OAuth2

Open KristinaB162 opened this issue 6 months ago • 5 comments

As described here https://github.com/OAI/OpenAPI-Specification/discussions/3001#discussioncomment-3456275, scopes can be expressed in different ways to illustrate logical relationships in an OpenApi Spec.

It is currently not possible to generate a logical OR in the permissions with the utoipa generator. When specifying multiple permissions in the path attribute macro, these are always linked to a logical AND.

I tried: security(("OAuth2" = ["A", "B"]))

and

security(("OAuth2" = ["A"]))
security(("OAuth2" = ["B"]))

What I get:

security:
  - oauth2:
    - A
    - B

What I want:

security:
  - oauth2:
    - A
  - oauth2:
    - B
Is there a way to generate the logical OR?

Thanks in advance!

KristinaB162 avatar Aug 16 '24 10:08 KristinaB162