-
Notifications
You must be signed in to change notification settings - Fork 323
Allow for scope descriptions #9126
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
base: main
Are you sure you want to change the base?
Conversation
commit: |
|
All changed packages have been documented.
Show changes
|
f02ce1c to
0e02281
Compare
|
|
||
| @doc("list of scopes for the credential") | ||
| scopes?: string[]; | ||
| scopes?: ScopeList; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some previous idea here was to allow an enum instead what do you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that instead of using OAuth2Scope, you would define scopes as e.g.
enum MyScopes {
Read: "Read public data",
Write: "Write private data",
}?
If so, I like it. I like that it gives you a convenient way to reference individual scopes.
Are there any other places where we employ enums this way (enum value is documentation / description)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah exactly, we do for the version enum where the value is the api version(though that also could be left to interpretation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good; I'll make that change.
This makes a small change to the code introduced in microsoft#849 to allow for models to be used as OAuth scopes. Without this check, an object like `{value: "foo", description: "bar"}` gets wrapped in an additional `value` key. When the OpenAPI3 emitter tries to print out the `securitySchemes`, it sees `{value: {...}}` and produces a scope with value `[object Object]` and no description.
0e02281 to
265b0b9
Compare
This makes a small change to the code introduced in #849 to allow for models to be used as OAuth scopes. Without this check, an object like
{value: "foo", description: "bar"}gets wrapped in an additionalvaluekey. When the OpenAPI3 emitter tries to print out thesecuritySchemes, it sees{value: {...}}and produces a scope with value[object Object]and no description.This also introduces a base
SecuritySchememodel that allows for more specific type checking on the@useAuthdecorator.We need to remove an
openapi3test that checks for an error when providing an unsupported auth type.Now the compiler enforces that the auth type is
AuthType, andopenapi3supports all of the types inAuthType, it should not be possible to trigger this condition in TSP.