-
Notifications
You must be signed in to change notification settings - Fork 292
Fix OAuth2 scope deduplication in OpenAPI spec generation #7771
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
Co-authored-by: chrisradek <14189820+chrisradek@users.noreply.github.com>
Co-authored-by: chrisradek <14189820+chrisradek@users.noreply.github.com>
/azp run typespec - pr tools |
Azure Pipelines successfully started running 1 pipeline(s). |
You can try these changes here
|
@copilot This needs a changelog added for the |
Co-authored-by: chrisradek <14189820+chrisradek@users.noreply.github.com>
Added changelog for @typespec/http package in commit e7a6b7c. |
Co-authored-by: chrisradek <14189820+chrisradek@users.noreply.github.com>
Co-authored-by: chrisradek <14189820+chrisradek@users.noreply.github.com>
@copilot Rerun formatter via |
Co-authored-by: chrisradek <14189820+chrisradek@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
When OAuth2 authentication schemes have multiple flows with the same scopes, the generated OpenAPI spec contained duplicate scope entries in the security section.
For example, with this TypeSpec definition:
The generated OpenAPI security section would incorrectly show:
Root Cause:
The
makeHttpAuthRef
function inpackages/http/src/auth.ts
was collecting scopes from all flows without deduplication, causing the same scope to appear multiple times when shared across flows.Fix:
Added
Array.from(new Set(scopes))
to deduplicate the scopes array before creating theOAuth2HttpAuthRef
object. This follows the same pattern already used in themergeOAuthScopes
function.Testing:
Fixes #7685.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.