Make variableDefinitions not nullable#2405
Conversation
It seems like `variableDefinitions` will always be a non-null array. https://github.com/graphql/graphql-js/blob/f07ec241d51d7c3fb0263bb3ade1975dc87babc3/src/language/parser.js#L258-L285 https://github.com/graphql/graphql-js/blob/f07ec241d51d7c3fb0263bb3ade1975dc87babc3/src/language/parser.js#L307
|
Thanks for PR 👍 return {
kind: Kind.OPERATION_DEFINITION,
selectionSet: someSelectionSet,
};And you don't need to add a bunch of empty arrays, moreover, it makes code less fragile when we add new properties to AST nodes. But I agree it looks weird and creates complications, for example with testing see #2203 |
|
closing this PR in favor of #4206 based on suggestion above in #2405 (comment) |
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.
see: graphql/graphql-js#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.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
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.
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.
see: graphql#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 graphql#2203 as our tests now cover the undefined case by default whenever there is an empty array.
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.
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.
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.
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.
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.
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.
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨
It seems like
variableDefinitionswill always be a non-null array.graphql-js/src/language/parser.js
Lines 258 to 285 in f07ec24
graphql-js/src/language/parser.js
Line 307 in f07ec24