-
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
Test all functions (with AST input) that they handle undefined
instead of array properites
#2203
Comments
IvanGoncharov
added a commit
to IvanGoncharov/graphql-js
that referenced
this issue
Jan 4, 2020
IvanGoncharov
added a commit
to IvanGoncharov/graphql-js
that referenced
this issue
Jan 4, 2020
IvanGoncharov
added a commit
that referenced
this issue
Jan 4, 2020
yaacovCR
added a commit
that referenced
this issue
Oct 14, 2024
see: #2405 (comment) Manually created ASTs always allowed undefined in place of empty arrays; this change simply updates the parser to more closely follow the manual approach. This is therefore not technically a breaking change, but considering that there may be tools not aware of this, we have labelled it a BREAKING_CHANGE to highlight it for consumers. This closes #2203 as our tests now cover the undefined case by default whenever there is an empty array.
Closed by #4206 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on @mjmahone comment #2084 (comment)
Currently
parse
always return empty arrays (and neverundefined
) but AST definitions explicitly supportundefined
.This is done to make AST forward-compatible meaning old code that generate/transformate AST and doesn't know about new properties (e.g.
interfaces
onInterfaceTypeDefinitionNode
node) is still compatible with newer versions ofgraphql-js
.It also means it's very easy to manually create nodes, for example creating
FieldNode
you can safely omitarguments
,directives
andselectionSet
properties so minimal field will look like:At the same time we need to be sure that functions like
buildSchema
,extendSchema
,print
,execute
, etc. are actually ready to handle such functions and don't crash when they getundefined
instead of an empty array.The text was updated successfully, but these errors were encountered: