fix(python): fix OAuth token provider for custom parameter names#16275
Draft
iamnamananand996 wants to merge 1 commit into
Draft
fix(python): fix OAuth token provider for custom parameter names#16275iamnamananand996 wants to merge 1 commit into
iamnamananand996 wants to merge 1 commit into
Conversation
Teach the OAuth token provider generator to: - Use request-properties mapping for parameter names (e.g. cid/csr instead of client_id/client_secret) - Accept and pass additional required parameters (scopes, non-literal custom properties) - Filter out literal and optional custom properties that are auto-populated Update root client generator to: - Add additional OAuth params to constructor signatures and overloads - Pass them through to OAuthTokenProvider instantiation - Assert non-None in OAuth client credentials branch for type safety Remove oauth-client-credentials-custom from allowedFailures.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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 free
to 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.
Description
Fixes the
oauth-client-credentials-customseed test failure by teaching the OAuth token provider generator to respect custom parameter name mappings and pass additional required parameters.Changes Made
oauth_token_provider_generator.py:_get_constructor_parametersto acceptclient_credentialsand generate constructor params for additional OAuth token endpoint parameters (scopes, required non-literal custom properties)_is_literal_type/_is_optional_typehelpers to distinguish auto-populated literal params from user-provided ones_get_additional_oauth_paramsto extract(param_name, member_name)pairs for scopes and required custom properties_get_refresh_function_invocationto pass additional params as kwargs in the token refresh callroot_client_generator.py:_get_additional_oauth_param_namesmirror helperOptional[str]withNonedefault for token-override compatibility)OAuthTokenProviderinstantiation in both standard and token-override code pathsassertstatements to narrow types in theelif client_id is not None and client_secret is not None:branchseed.yml: Removedoauth-client-credentials-customfromallowedFailuresTesting
pnpm seed:local test --generator python-sdk --fixture oauth-client-credentials-custom→ successpoetry run mypy .on generated output →Success: no issues found in 61 source filespoetry run pytest -rP -n auto .→66 passed, 4 skippedoauth-client-credentialsandoauth-client-credentials-openapistill pass (no code changes to those fixtures)Link to Devin session: https://app.devin.ai/sessions/4e0c080d0e2a40bbb153fa05e4dd653d
Requested by: @iamnamananand996