Comments (2)
Hey, thanks for asking. It was probably mistakenly added a long time ago 🙈 . I bet nobody has reported the problem since it can be worked around by removing the !
.
Thanks for linking the relevant spec, @benjie -- I agree, removing it sounds like the right way forward.
from graphql-ruby.
I can confirm that my understanding of the spec suggests this:
query MyQuery($skip: Boolean! = true) {
__typename @skip(if: $skip)
}
is a valid query for any GraphQL schema, even with no variables provided.
CoerceVariableValues
in the spec details what happens when there's a default value but no supplied value:
3.g. If hasValue is not true and defaultValue exists (including null):
3.g.i. Add an entry to coercedValues named variableName with the value defaultValue.
As far as I am aware, there is no rule in the spec forbidding a defaultValue on a non-null variable, nor on arguments nor on input fields. These positions are "required" if they are a non-nullable type and they have no default. Giving them a default makes them "optional" (they're also optional if they are nullable).
Note to self on `= null` default
Note to self: having = null
is not permitted due to the Values of Correct Type rule; namely:
Literal values must be compatible with the type expected in the position they are found as per the coercion rules defined in the Type System chapter.
See https://github.com/graphql/graphql-spec/pull/793/files#diff-0f02d73330245629f776bb875e5ca2b30978a716732abca136afdd028d5cd33c for related PR that I really should get back around to.
from graphql-ruby.
Related Issues (20)
- Can't use fields with the name object/context, reserved terms? HOT 3
- Fiber-local variables are not copied when using AsyncDataloader HOT 4
- Directives Ignored in Patch Upgrade from v2.3.5 to v2.3.6 HOT 3
- `GraphQL::Query#variables` raises `GraphQL::Schema::Enum::MissingValuesError` when the enum isn't visible
- Fields with lazy results aren't resolved inside directive context HOT 1
- Broadcasting for nodes field HOT 1
- Using query params in SQL select HOT 2
- Remove previous token tracking because it's unused
- Return result keys in the same order as the request
- Improve visiblity / type filtering HOT 3
- Some exception class names are unstable when using `GraphQL::Schema.from_definition` HOT 3
- Upgrade to 2.3.8 breaks subscriptions in the schema HOT 3
- Error paths and locations are duplicated with duplicate queries that error lazily
- Schema parsing fails when a union has a leading pipe HOT 1
- graphql_name does not take effect HOT 2
- the GraphQL::Schema::Field initialize , ` type` is nil after upgrading GraphQL to the latest version? HOT 5
- Parser does not allow operation names that match the built in operation types HOT 1
- Audit `compare_by_identity` usage
- Query complexity check causes wrong GraphQL error response HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-ruby.