Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 9, 2025

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 CasingsGenerator to 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

  • Added new casings.ts file with utility functions:
    • toCamelCase(str, options?) - converts to camelCase
    • toPascalCase(str, options?) - converts to PascalCase
    • toSnakeCase(str, options?) - converts to snake_case
    • toScreamingSnakeCase(str, options?) - converts to SCREAMING_SNAKE_CASE
    • sanitizeName(name, options?) - sanitizes names based on language keywords
  • Each function returns SafeAndUnsafe with both safe and unsafe name variants
  • Functions support CasingOptions for language-specific keywords, smart casing, and generation language
  • Refactored CasingsGenerator.ts to delegate to the new to*Case helpers (eliminating ~170 lines of duplicated code)

Python Generator Migration

  • Created PythonCasing.ts with Python-specific casing helpers (pythonToCamelCase, pythonToPascalCase, pythonToSnakeCase, pythonToScreamingSnakeCase)
  • Migrated Python generator files to compute casing from originalName instead of using pre-computed values:
    • AbstractPythonGeneratorContext.ts - updated getClassName, getPascalCaseSafeName, getSnakeCaseSafeName
    • DynamicSnippetsGeneratorContext.ts - updated getClassName, getPropertyName, getMethodName, getEnvironmentEnumName
    • EnumGenerator.ts - updated enum member and parameter name generation
    • WrappedAliasGenerator.ts - updated getter/builder name generation
    • WireTestGenerator.ts - updated test ID and function name generation
    • WireTestSetupGenerator.ts - updated auth scheme parameter name generation
  • Updated generators/python/sdk/versions.yml with version 4.45.1 (chore entry)

Human Review Checklist

  • Behavior-preserving refactor: The refactored CasingsGenerator should produce identical output to the original. All casing logic, initialism handling, and keyword sanitization has been moved to casings.ts without modification.
  • Property ordering: The Name object properties are returned in the original order (camelCase, snakeCase, screamingSnakeCase, pascalCase) to avoid snapshot diffs.
  • Python migration correctness: Verify that computing casing from originalName produces the same results as the pre-computed values. The Python-specific options (generationLanguage: "python", smartCasing: true) should match the original behavior.
  • No snapshot changes expected: This is an internal refactoring - generated SDK output should be identical.

Testing

  • Lint checks pass (pnpm run check)
  • Python generator packages compile successfully
  • Seed tests for Python generators (CI will verify)
  • Unit tests added/updated

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration bot changed the title feat(casings-generator): add utility functions to convert wireValue to different case formats feat(internal): add utility functions to convert wireValue to different case formats Dec 9, 2025
devin-ai-integration bot and others added 7 commits December 9, 2025 21:47
…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]>
@devin-ai-integration devin-ai-integration bot changed the title feat(internal): add utility functions to convert wireValue to different case formats feat(python): add casing utility functions and migrate Python generators Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant