Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(openapi): reflect fallback security scheme in spec #958

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

patrickariel
Copy link
Contributor

@patrickariel patrickariel commented Feb 4, 2025

This makes it so that security schemes with a fallback:

#[derive(SecurityScheme)]
enum MySecurityScheme {
    MySecuritySchemeBasic(MySecuritySchemeBasic),
    #[oai(fallback)]
    NoAuth,
}

Will be reflected in the OpenAPI schema:

"security": [
  {
    "MySecuritySchemeBasic": []
  },
  {} // <-- the fallback scheme
]

This is the correct way to define optional security schemes, according to the official specification as of version 3.0.3.

Closes #959

@stevenj
Copy link

stevenj commented Feb 12, 2025

This looks great. Would love to see this merged.

@attila-lin attila-lin merged commit 93f06ce into poem-web:master Feb 12, 2025
7 checks passed
@attila-lin
Copy link
Collaborator

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optional or No Authorization
3 participants