-
-
Notifications
You must be signed in to change notification settings - Fork 215
Reducing security schema duplicates in OpenAPI parser #2479
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?
Reducing security schema duplicates in OpenAPI parser #2479
Conversation
|
|
@michalgrezel is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2479 +/- ##
==========================================
+ Coverage 22.78% 23.73% +0.94%
==========================================
Files 338 338
Lines 33733 33733
Branches 1353 1404 +51
==========================================
+ Hits 7686 8005 +319
+ Misses 26037 25718 -319
Partials 10 10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cd77abf
to
2e36dcd
Compare
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.
Hey @dracomithril, I'm not opposed to this change, but you need to make sure it doesn't discard unique values such as
security:
- oauth2: [read]
- oauth2: [write]
Thank you @mrlubos for pointing that out. Are there any examples of using scopes? |
I don't think there are any examples. It's not security:
- foo: [scope1]
- foo: [scope2] Your changes are keyed only based on name. That could mean the user receives only |
so I checked in the code and current implementation does not care about scope at all at least from what I see openapi-ts/packages/openapi-ts/src/openApi/3.0.x/parser/index.ts Lines 65 to 73 in df9b830
so what ever scope you provide it will still resolve in the same way would we would need to to is extend object in |
to add to it from what I understand in
but in # openapi 3.0.x
spec:
components:
securitySchemes:
foo:
type: 'oauth2'
flows:
password:
scope:
scope1: 'Grants read access'
scope2: 'Grants write access'
tokenUrl: 'http://some/auth' so in current implementation it will still resolve to the same thing we would need to extend logic to have specific path scope added so then on |
71bfe9e
to
1fdf359
Compare
1fdf359
to
9b7b235
Compare
5d81037
to
82549d9
Compare
82549d9
to
192a1f5
Compare
192a1f5
to
36ce55f
Compare
When security schemas are provided with duplicates we end up with array with repeated security expectations
example:
we end up with array where expected values are repeated
this PR is to resolve that and obtain short list of security measures that need to be meet