jlouis / graphql-erlang

GraphQL implementation in Erlang.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jun2018 spec: Make sure there is no ambiguity with null values (facebook/graphql/#418)

jlouis opened this issue · comments

There is currently ambiguity and inconsistency in how null values are coerced and resolved as part of variable values, default values, and argument values. This inconsistency and ambiguity can allow for null values to appear at non-null arguments, which might result in unforseen null-pointer-errorrs.

Fix this coercion problem by handling each of the cases according to the issue.

The key new feature is that if you have a non-null input, with a default, then this is allowed and the field isn't "required" per se anymore. Another key feature is that if you have a $var : T for some (nullable) type T, then this can be used in a non-null context proviso that context supplies a default value. In short, default value handling is now more lenient.

While handling this case, also handle the issue 388 in the GraphQL specification. This issue handles how input coercion of more complex types are supposed to work in the specification. It requires handling while one is handling this case as well as they are intermixed.