swagger-api / swagger-api/swagger-ui
securitySchemes - Semantic error - Security requirements must match a security definition
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
- Swagger/OpenAPI version: OpenAPI 3.0.1
Example Swagger/OpenAPI definition:
components:
securitySchemes:
OAuth2q:
type: "oauth2"
flows:
clientCredentials:
tokenUrl: "https://api-test.XXXXX.com/oauth/token"
scopes: {}
Describe the bug you're encountering
- We are required to create 2 securitySchemes for an OAuth2 clientCredentials
- Swagger UI only allow one OAuth2 name
- securitySchemes name is case-sensitive
- securitySchemes will not allow duplicate name
- The same behavior when tested in https://editor.swagger.io/
- We isolated the issue by just using one invalid name (ex: OAuth2q)
Screenshots

Additional context or thoughts
Screenshot when trying to remove the arbitrary name:

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
Start by reproducing the reported behavior in Swagger UI and editor.swagger.io with the supplied OpenAPI 3.0.1 securitySchemes example, including the OAuth2q name. Trace how the security requirement is matched to the security definition; done means the valid case is accepted without requiring duplicate schemes and the invalid-name behavior is clearly defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- api, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100