388 fix optional argument handling #404
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #388
Checklist
Description
Changes the default behavior of
Optionalmapping when used as an input parameter.This is an adjustment to my previous PR on this topic #310.
Both options are now supported and the behavior is configurable via the boolean switch
inputArgumentOptionalDetectOmission:truean omitted GraphQL argument during query is converted tonulland an explicit GraphQLnullis converted toOptional.empty()(294 handle optional parameters #310)falseboth an omitted GraphQL argument and explicitnullis converted toOptional.empty(); therefore the value is nevernull; this is the new default!I am choosing to make this a breaking change and make the second option the default for these reasons:
Optionalis nevernull.The old behavior will be kept for those users that do not care about the reasons above and want to continue using it. But they will have to opt-in to it by setting
inputArgumentOptionalDetectOmissiontotrue.