default value fixes#739
Conversation
A field or directive argument declared with a non-null type and a default value is satisfied by the default when omitted, so ProvidedNonNullArgumentsRule must not flag it as required. Matches graphql-js's ProvidedRequiredArgumentsRule and supports directives with the shape `@defer(if: Boolean! = true)` from the incremental delivery RFC.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Hi there! I'm the maintainer of graphql-conformance, a GraphQL verifier similar to thesis-graphql-go.
I noticed that graphql-go has a couple of deviations from the spec and I thought I might be able to contribute a fix for one of the easy ones (see graphql-go's conformance page for other gaps).
This PR fixes an issue that prevents arguments with non-nullable types from having default values.
For example, in this configuration:
graphql-go returns this error:
{ "data": null, "errors": [ { "message": "Field \"x\" argument \"y\" of type \"Int!\" is required but not provided.", "locations": [ { "line": 1, "column": 3 } ] } ] }With this PR applied, the above query now returns:
{ "data": { "x": 0 } }This kind of usage is explicitly allowed by section 5.4.3 of the graphql-spec:
Thank you for considering this PR! I'm not familiar with this code-base or its conventions, so please feel free to point out any issue no matter how small.
Summary by CodeRabbit
Bug Fixes
Tests