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
Optional
mapping 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
:true
an omitted GraphQL argument during query is converted tonull
and an explicit GraphQLnull
is converted toOptional.empty()
(294 handle optional parameters #310)false
both an omitted GraphQL argument and explicitnull
is 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:
Optional
is 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
inputArgumentOptionalDetectOmission
totrue
.