-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add 'isRequredArgument' & 'isRequredInputField' predicates #1465
Add 'isRequredArgument' & 'isRequredInputField' predicates #1465
Conversation
!argNode && | ||
isNonNullType(argDef.type) && | ||
argDef.defaultValue === undefined | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They make code more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.