Add 'isRequredArgument' & 'isRequredInputField' predicates#1465
Add 'isRequredArgument' & 'isRequredInputField' predicates#1465IvanGoncharov merged 1 commit intographql:masterfrom
Conversation
| !argNode && | ||
| isNonNullType(argDef.type) && | ||
| argDef.defaultValue === undefined | ||
| ) { |
There was a problem hiding this comment.
They make code more readable.
mjmahone
left a comment
There was a problem hiding this comment.
@IvanGoncharov is this something you're planning on re-using, or is it just to make this one location more readable?
I don't think it drastically improves readability, and there's some danger that isRequiredArgument would be implemented for a VariableDefinition instead of inside the Schema's Argument definition.
If you're going to use this elsewhere, it makes sense, otherwise we should leave things as-is.
|
|
1595507 to
504ac62
Compare
|
@Marak Thanks a lot 👍 Fixed.
@mjmahone It's actually a very very painful topic. Initially I didn't want to overburden you with technical details but here is a full story. So before graphql/graphql-spec#418 That makes me pay extra attention to all graphql-js/src/utilities/findBreakingChanges.js Lines 250 to 257 in 7cfd686 Adding non-null argument with a default value is not a breaking change. graphql-js/src/type/validate.js Lines 441 to 450 in 7cfd686 Same problem here since according to the spec:
And probably many more places since |
|
@mjmahone I just remembered that Lee made graphql-js/src/type/definition.js Line 1140 in 7cfd686 But I can't use graphql-js/src/utilities/buildASTSchema.js Line 311 in 7cfd686 I think it's even bigger reason to use dedicated function for this check. |
mjmahone
left a comment
There was a problem hiding this comment.
@IvanGoncharov that makes sense, thank you for the backstory: it makes the motivation clear and agreement that this is desirable easy to reach.
Add 'isRequredArgument' & 'isRequredInputField' predicates (graphql#1465)
Disscussed here: graphql#1465 (comment)
Disscussed here: #1465 (comment)
No description provided.