graphql / graphql-playground

🎮 GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration)
MIT License
8.76k stars 734 forks source link

Incorrect lint error for optional non null arguments #930

Open Farzadd opened 5 years ago

Farzadd commented 5 years ago

This issue pertains to the following package(s):

What OS and OS version are you experiencing the issue(s) on?

macOS High Sierra, Chrome

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

graphql-playground-html 1.6.6

What is the expected behavior?

No error should be thrown by linter since the argument has a default value. The query is valid and runs successfully.

What is the actual behavior?

Lint error: Field "foo" argument "bar" of type String! is required but not provided

What steps may we take to reproduce the behavior?

Add a query to the schema that has a optional (default value) not null argument: type Query { foo(bar: String! = "some value") }

Try to query it via Playground without providing a value for foo: { foo { ... } }

Please provide a gif or image of the issue for a quicker response/fix. image image

Farzadd commented 5 years ago

This issue was resolved by graphql in version 14.0.0 (current version is 14.1.1 however the version in use by playground is 0.11.7). Updating the graphql dependency will address it.

huv1k commented 5 years ago

Hey @Farzadd thanks for reporting that, we need to upgrade graphql version soon, but it will take some time.