-
Notifications
You must be signed in to change notification settings - Fork 272
feat(python): add casing utility functions and migrate Python generators #11131
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
Open
devin-ai-integration
wants to merge
11
commits into
main
Choose a base branch
from
devin/1765315602-remove-name-case-variations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(python): add casing utility functions and migrate Python generators #11131
devin-ai-integration
wants to merge
11
commits into
main
from
devin/1765315602-remove-name-case-variations
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
…o different case formats Co-Authored-By: [email protected] <[email protected]>
Contributor
Author
🤖 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:
|
…lpers Co-Authored-By: [email protected] <[email protected]>
…mic-snippets Co-Authored-By: [email protected] <[email protected]>
…lity functions - Create PythonCasing.ts with Python-specific casing options - Update AbstractPythonGeneratorContext to use pythonToPascalCase/pythonToSnakeCase - Update DynamicSnippetsGeneratorContext to compute casing from originalName - Update EnumGenerator to use toScreamingSnakeCase/toSnakeCase - Update WrappedAliasGenerator to use toSnakeCase - Update WireTestGenerator to use toCamelCase/toSnakeCase - Update WireTestSetupGenerator to use toSnakeCase This is an internal refactoring with no impact on generated SDK output. Co-Authored-By: [email protected] <[email protected]>
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
Refs: Requested by [email protected]
Link to Devin run: https://app.devin.ai/sessions/1876d569a1d54ec382418831648a8a14
This PR adds standalone utility functions to convert strings (wireValue) to different case formats, refactors
CasingsGeneratorto use them as a single source of truth, and migrates Python generators to use the new casing utilities instead of pre-computed Name case variations.Changes Made
Casing Utility Functions
casings.tsfile with utility functions:toCamelCase(str, options?)- converts to camelCasetoPascalCase(str, options?)- converts to PascalCasetoSnakeCase(str, options?)- converts to snake_casetoScreamingSnakeCase(str, options?)- converts to SCREAMING_SNAKE_CASEsanitizeName(name, options?)- sanitizes names based on language keywordsSafeAndUnsafewith both safe and unsafe name variantsCasingOptionsfor language-specific keywords, smart casing, and generation languageCasingsGenerator.tsto delegate to the newto*Casehelpers (eliminating ~170 lines of duplicated code)Python Generator Migration
PythonCasing.tswith Python-specific casing helpers (pythonToCamelCase,pythonToPascalCase,pythonToSnakeCase,pythonToScreamingSnakeCase)originalNameinstead of using pre-computed values:AbstractPythonGeneratorContext.ts- updatedgetClassName,getPascalCaseSafeName,getSnakeCaseSafeNameDynamicSnippetsGeneratorContext.ts- updatedgetClassName,getPropertyName,getMethodName,getEnvironmentEnumNameEnumGenerator.ts- updated enum member and parameter name generationWrappedAliasGenerator.ts- updated getter/builder name generationWireTestGenerator.ts- updated test ID and function name generationWireTestSetupGenerator.ts- updated auth scheme parameter name generationgenerators/python/sdk/versions.ymlwith version 4.45.1 (chore entry)Human Review Checklist
CasingsGeneratorshould produce identical output to the original. All casing logic, initialism handling, and keyword sanitization has been moved tocasings.tswithout modification.camelCase,snakeCase,screamingSnakeCase,pascalCase) to avoid snapshot diffs.originalNameproduces the same results as the pre-computed values. The Python-specific options (generationLanguage: "python",smartCasing: true) should match the original behavior.Testing
pnpm run check)