-
Notifications
You must be signed in to change notification settings - Fork 310
fix: enum arguments in nested input objects #1362
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
Merged
Merged
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
Add test case that reproduces the bug where enum arguments in nested input objects are incorrectly rendered as strings instead of enum values. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Fixed issue where enum values in nested input objects were being rendered as strings instead of enum values in GraphQL queries - Modified $parseSelection to only strip enum prefix from top-level argument keys, preserving $ prefix in nested object values - Updated Value.ts to detect enum fields by $ prefix and properly set context for enum value processing - Updated test snapshots to reflect correct enum value rendering Fixes #1351 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
jasonkuhrt
commented
Jul 14, 2025
src/extensions/DocumentBuilder/SelectGraphQLMapper/__snapshots__/toGraphQL.test.ts.snap
Outdated
Show resolved
Hide resolved
When using variables mode, enum field names in input objects were incorrectly keeping their $ prefix in the GraphQL variables object. This fix ensures that $ prefixes are stripped from enum field names when capturing variables, matching the behavior of top-level enum args. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Move `stripEnumPrefixesFromVariableValue` to `arguments.ts` as `enumKeyPrefixStripFromObject` to colocate it with other enum helpers. This improves code organization and makes the function more reusable. The new function is more general and efficient, using direct object iteration instead of the `mapVariableValue` utility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Extract `mapVariableValue` from grafaid into a generic `mapEntriesDeep` utility in `lib/object-utils.ts`. This function had no GraphQL-specific logic and is useful for any deep object transformation. Changes: - Add `mapEntriesDeep<T>()` - generic deep object visitor pattern utility - Update `enumKeyPrefixStripFromObject()` to use the generic utility - Deprecate `mapVariableValue()` and `mapVariables()` in favor of `mapEntriesDeep` - Improve naming: "mapEntriesDeep" clearly indicates deep key-value transformation Benefits: - Reusable across codebase for any deep object transformations - Better separation of concerns - More descriptive naming - Removes code duplication 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Remove `mapVariables` and `mapVariableValue` functions from grafaid/request.ts as they were deprecated and had no usages in the codebase. These functions have been replaced by the generic `mapEntriesDeep` utility. Also includes minor linting fixes (import ordering, whitespace). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[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.
Fixes #1351