swagger-api / swagger-api/swagger-ui
Scopes not updated on modal when I change definitions
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A
- OS: macOS
- Browser: chrome
- Version: 86.0.4240.80
- Method of installation: dist assets
- Swagger-UI version: 3.35.2
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Swagger-UI configuration options:
window.ui = SwaggerUIBundle({
urls: specsUrls,
dom_id: '#swagger-ui',
filter: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: 'StandaloneLayout',
validatorUrl: null,
oauth2RedirectUrl: defaultRedirectUrl
});
I use two specifications on two different urls:
Account:
{
"openapi": "3.0.1",
"info": {
"title": "Account",
"version": "1.0"
},
"servers": [
{
"url": "/api"
}
],
"paths": {
"/accounts/v1/me": {
"get": {
...,
"security": [
{
"Oauth2Application": [
"read:me"
]
},
{
"Oauth2AuthorizationCode": [
"read:me"
]
}
]
}
}
},
"components": {
"schemas": {
...
},
"securitySchemes": {
"Oauth2Application": {
"type": "oauth2",
"flows": {
"clientCredentials": {
"tokenUrl": "XXX",
"scopes": {
"read:me": "Self account read",
"write:me": "Self account write"
}
}
}
},
"Oauth2AuthorizationCode": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "XXX",
"tokenUrl": "XXX",
"scopes": {
"read:me": "Self account read",
"write:me": "Self account write"
}
}
}
}
}
}
}
And Assets:
{
"openapi": "3.0.1",
"info": {
"title": "Assets",
"version": "1.0"
},
"servers": [
{
"url": "/api/assets/v1"
}
],
"paths": {
"/assets": {
"get": {
...,
"security": [
{
"Oauth2Application": [
"read:assets"
]
},
{
"Oauth2AuthorizationCode": [
"read:assets"
]
}
]
}
}
},
"components": {
"schemas": {
...
},
"securitySchemes": {
"Oauth2Application": {
"type": "oauth2",
"flows": {
"clientCredentials": {
"tokenUrl": "XXX",
"scopes": {
"read:assets": "Read your assets",
"write:assets": "Create and update your assets"
}
}
}
},
"Oauth2AuthorizationCode": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "XXX",
"tokenUrl": "XXX",
"scopes": {
"read:assets": "Read your assets",
"write:assets": "Create and update your assets"
}
}
}
}
}
}
}
Description
Hello !
I have one problem on scopes on oauth2 modal when I use the topbar component: it seems the scopes are not reloaded on url change.
To reproduce...
Steps to reproduce the behavior:
- Go to default definition ("Account")
- Click on Authorize button
- See "Account" scopes "read:me" and "write:me"
- Close modal
- Change definition to "Assets"
- Click on Authorize button
- See "Account" scopes "read:me" and "write:me" instead of "Assets" scopes "read:assets" and "write:assets"
Expected behavior
On step 7, I wan't to see the "Assets" scopes.
Screenshots
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the two Account and Assets OpenAPI definitions, using the topbar definition selector and OAuth2 authorize modal. Inspect the authorize modal's handling of definition changes; done means switching to Assets shows read:assets and write:assets instead of the Account scopes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100