Skip to content

Optional scopes for required security scheme #431

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

Closed
diogeneshamilton opened this issue Aug 1, 2015 · 2 comments · May be fixed by ekmixon/OpenAPI-Specification#2 or MaxMood96/OpenAPI-Specification#40

Comments

@diogeneshamilton
Copy link

OAuth 2 doesn't have a restriction on scopes needing encompass a whole endpoint, so I'd like a way in Swagger to define an optional scope. For example, returning the user's email on the /users/{user_id} endpoint allows an optional access_email scope. I could create new security schemes for each combination, but that's pretty cumbersome, especially with 5-10 possible scope combinations.

@RobDolinMS
Copy link
Contributor

@diogeneshamilton It looks like this issue hasn't been commented in a while. Is this still an issue?

@diogeneshamilton
Copy link
Author

It looks to me like this is possible to document this type of behavior through multiple security scheme definitions, paired with multiple example responses, but unfortunately without it being more explicitly supported, there would not be a possibility of using tools like codegen to work with this type of security scheme.

At this point, the better solution is probably not to build an API with this functionality, if you're planning on using OpenAPI 🥇

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