You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was working with input fields' default values in graphql-core and I encountered a problem with a combination of recursive inputs and default values which also occurs in graphql-js.
Let's take this SDL as an example:
If I understand correctly that example is invalid, because {value: "foo"} is lacking the self field, then the default value for self is looked up, which leads to a recursion error - RangeError: Maximum call stack size exceeded.
When the default value is removed, everything works fine:
Ses also the section on Circular References in the GraphQL spec which explicitly states that example 2 is valid, while example 4 is invalid. From the section I would also conclude that example 3 is valid, while example 1 is invalid, though the documentation is less clear about it, and does not contain examples with default values.
Hi, I was working with input fields' default values in graphql-core and I encountered a problem with a combination of recursive inputs and default values which also occurs in
graphql-js
.Let's take this SDL as an example:
If I understand correctly that example is invalid, because
{value: "foo"}
is lacking theself
field, then the default value forself
is looked up, which leads to a recursion error -RangeError: Maximum call stack size exceeded
.When the default value is removed, everything works fine:
However, the following also looks fine, because
self
doesn't need to be looked up, but it still causes a recursion error:On the other hand, the following actually invalid example does not give an error:
If I'm not mistaken:
To test all examples I used
graphql@16.6.0
and following code:The text was updated successfully, but these errors were encountered: