-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforces input coercion rules. #553
Conversation
Before this diff, bad input to arguments and variables was often ignored and replaced with `null` rather than rejected. Now that `null` has a semantic meaning, and thanks to some recent changes to the spec (graphql/graphql-spec#221) - changes are necessary in order to enforce the stricter coercion rules. This diff does the following: * Implements the CoerceArgumentValues as described in the spec. * Implements the CoerceVariablesValues as described in the spec. * Alters valueFromAST and coerceValue (dual functions) to strictly enforce coercion, returning `undefined` implicitly when they fail to do so. It also fixes issues where undefined returns were being ignored as items in a list or fields in an input object.
Some of this ends up being follow-up to @langpavel's #544 as edges cases with support for null interrelates to the strict coercion rules. |
Well done! |
@leebyron it appears that errors thrown from |
Certainly retaining a reference to |
Before this diff, bad input to arguments and variables was often ignored and replaced with
null
rather than rejected. Now thatnull
has a semantic meaning, and thanks to some recent changes to the spec (graphql/graphql-spec#221) - changes are necessary in order to enforce the stricter coercion rules.This diff does the following:
undefined
implicitly when they fail to do so. It also fixes issues where undefined returns were being ignored as items in a list or fields in an input object.