fix(graphql-codegen): preserve digit suffix pascal case - #637
Conversation
|
Review: fix(graphql-codegen): preserve digit suffix pascal caseThanks for the fix — the change is small, focused, well-commented, and comes with good test coverage (both a direct One correctness concern:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8efab6428
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| } else if chars[i - 1].is_lowercase() && chars[i].is_uppercase() { | ||
| // lowercase → uppercase (e.g., someEG: e→E) | ||
| true | ||
| } else if chars[i - 1].is_numeric() && chars[i].is_alphabetic() { |
There was a problem hiding this comment.
Avoid splitting digits before lowercase letters
When a valid GraphQL operation or fragment name contains a digit followed by a lowercase letter, such as query Foo1bar, this new condition treats the 1b transition as a word boundary. The transform then converts the appended name Foo1barDocument to Foo1BarDocument, while change-case-all#pascalCase leaves that lowercase continuation intact and only needs the digit→uppercase split for suffixes like Document/FragmentDoc; this makes the plugin import a symbol that the generated graphql.ts does not export.
Useful? React with 👍 / 👎.
f8efab6 to
693c1be
Compare
Review: fix(graphql-codegen): preserve digit suffix pascal caseThanks for the fix! I reviewed the change and ran Correctness ✅The new
The branch is correctly placed as a mutually-exclusive Test coverage ✅Good coverage — both a direct
Minor / optional nits
SummaryCorrect, minimal, and well-tested fix that aligns the plugin with the upstream client-preset naming. No blocking concerns. LGTM. 🚀 |
Summary
Fixes #630.
This updates the GraphQL codegen client preset plugin's PascalCase normalization so a digit-to-letter transition is treated as a word boundary. That keeps generated import names aligned with
@graphql-codegen/client-presetfor names such asHero30FragmentDocandFoo1Document.Changes
digit -> letterboundary rule into_pascal_case.fragment Hero30andquery Foo1.Validation
cargo test -p swc_plugin_graphql_codegen_client_preset --lib