Uh oh!
There was an error while loading. Please reload this page.
fix(spec): use global apiKey security for GET /models/user - #582
Open
rajarshidattapy wants to merge 1 commit into
Open
fix(spec): use global apiKey security for GET /models/user#582rajarshidattapy wants to merge 1 commit into
rajarshidattapy wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Body
Fixes#581.
Problem
models.list_for_user()is the only method in the SDK (1 of 95 operations) that requiresan operation-level
security=argument, so the client-levelapi_keyis ignored for it:The cause is in the OpenAPI document, not the generator.
components.securitySchemesdeclares two byte-identical schemes —
apiKeyandbearer, bothhttp/bearerwith thesame description. The document default is
apiKey(8 references), andlistModelsUseralone overrides it with
bearer(1 reference, the only one in the spec). Because the namediffers from the global scheme, global security can't be hoisted and the generator emits a
required per-operation credential.
Change
A new overlay, applied last in the chain, does the two removes suggested in the issue:
security: [bearer]from$.paths["/models/user"].get, so the operation inheritsthe document-level
security: [apiKey]like the other 94 operations$.components.securitySchemes.bearer, which has no references left afterwards.speakeasy/out.openapi.yamlis the output of the overlay chain, so the same two removesare applied there to keep the checked-in artifact in sync (-6 lines).
Verification
The Speakeasy CLI isn't available in my environment, so I verified the spec directly:
in.openapi.yaml— a no-matching overlay would silently donothing, the failure mode the
deprecated-beta-responses-aliasoverlay comments warnabout — and
bearerparses as an exact duplicate ofapiKeyout.openapi.yamlhassecuritySchemes == {apiKey}, nosecuritykeyon
listModelsUser, globalsecuritystill[{apiKey: []}], and zero operations acrossall 72 paths referencing a missing scheme
operationId: listModelsUser,x-speakeasy-name-override: listForUser, and thepagination extensions on the operation are untouched
src/is intentionally unchanged.This PR only touches the spec and overlay chain; regenerating needs the Speakeasy CLI.
On the follow-up regen, expect
securityto drop offModels.list_for_user/list_for_user_async(models_.py:1067,:1239),operations.ListModelsUserSecuritytodisappear, and the
OPENROUTER_BEARERsnippet to fall out ofdocs/sdks/models/README.mdx. Worth confirming on the regen PR before closing #581.One judgment call
Removing the
bearerscheme means a future monorepo sync that points an operation atbearerwill fail generation loudly rather than silently shipping anotherrequired-credential method. I think loud is the right trade here, but if you'd rather not
risk blocking the auto-merge bot, drop the second overlay action — the
/models/useroverride removal alone fixes the reported symptom.
Note that the real fix belongs in the monorepo spec; this overlay is the local mitigation
until
beareris removed upstream.