Repository navigation
fix(graphql-codegen-client-preset): support document variable naming options - #675
Conversation
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4de3c687c
ℹ️ 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".
…options Co-authored-by: Martin Sanders <1200529+m-sanders@users.noreply.github.com>
520ddda to
5f6b034
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f6b034bac
ℹ️ 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".
| "change-case-all#pascalCase" => s | ||
| .split('_') | ||
| .map(to_pascal_case) | ||
| .collect::<Vec<_>>() | ||
| .join("_"), |
There was a problem hiding this comment.
Retain underscore conversion for object naming conventions
When both configurations use namingConvention: { "typeNames": "change-case-all#pascalCase" }, an operation named Get_User now imports Get_UserDocument, whereas Codegen exports GetUserDocument. Codegen's naming implementation defaults underscore transformation to true for an explicitly configured object typeNames converter, unlike string conventions. Since as_type_name_convention() discards that distinction, unconditionally preserving underscores here breaks previously working imports even without custom affixes. Retain the object-specific underscore policy when resolving the naming convention.
Useful? React with 👍 / 👎.
The plugin always imports operation and fragment documents with
DocumentandFragmentDocsuffixes. WithdocumentVariableSuffix: ""in Codegen, it importsGetUserDocumenteven though Codegen exportsGetUser.Add
documentVariablePrefix,documentVariableSuffix,fragmentVariablePrefix,fragmentVariableSuffix,dedupeOperationSuffix, andomitOperationSuffixwith backward-compatible defaults. Apply the naming convention to the combined prefix, name, and suffix. Match Codegen's fragment suffix deduplication and omission rules; these flags leave operation document variable names unchanged.Document the options in
README.tmpl.mdand add regression tests for empty suffixes, custom affixes on all operation kinds, naming conventions, case-insensitive fragment deduplication, and omission precedence.Rust validation passed on
a4de3c6. The follow-up commit changes documentation only; Rust tests were not rerun.Validation:
cargo test -p swc_plugin_graphql_codegen_client_preset— passed, 21 tests.rustfmt --edition 2021 --check contrib/graphql-codegen-client-preset/src/lib.rs contrib/graphql-codegen-client-preset/src/tests.rs— passed.git diff --check— passed. The documentation follow-up also passedgit diff --cached --check.Closes #610