-
-
Notifications
You must be signed in to change notification settings - Fork 831
feat: add default values handling to buildOperationNodeForField #5269
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
feat: add default values handling to buildOperationNodeForField #5269
Conversation
🦋 Changeset detectedLatest commit: 68b55a3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
d34fb65
to
b8bf584
Compare
18927cb
to
9a4f0b6
Compare
Caution Review failedThe pull request is closed. 📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds propagation of GraphQL argument default values into VariableDefinitionNode when building operations, updates imports and fallback handling for AST conversion, adds tests for query and mutation defaults, and includes a changeset documenting a minor package update. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Schema
participant Builder as buildOperationNodeForField
participant ArgLoop as Arg Iterator
participant Typed as astFromValue
participant Untyped as astFromValueUntyped
Caller->>Builder: buildOperationNodeForField({ schema, kind, field })
Builder->>Schema: lookup field + arguments
Builder->>ArgLoop: iterate arguments
ArgLoop->>Typed: astFromValue(arg.defaultValue, arg.type)
alt typed conversion succeeds
Typed-->>ArgLoop: DefaultValue AST
else typed conversion throws
ArgLoop->>Untyped: astFromValueUntyped(arg.defaultValue)
Untyped-->>ArgLoop: DefaultValue AST (untyped)
end
ArgLoop-->>Builder: VariableDefinitionNode (with defaultValue if present)
Builder-->>Caller: DocumentNode (operation with variable defaults)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Thanks for the PR! Sorry for the late review! |
Description
Fixes #5268 where the feature request for propagating default values when building operations for field has been elaborated.
Related # (issue)
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Environment:
@graphql-tools/...
:Checklist: