Skip to content

Support checks if GraphQL argument was set to null or omitted entirely #518

Closed
@rstoyanchev

Description

@rstoyanchev

By default input arguments in GraphQL are nullable and optional, see Nullable vs Optional, which means an argument can be set to null, or not provided at all. The distinction enables partial updates in mutations where the underlying data storage can also be either set to null or not changed at all.

As described in #140 and #228, when binding an argument via @Argument, there is no way to make such a distinction. You can get a null or an empty Optional for the resulting value, but no way to check if the argument was omitted or not.

We can provide ArgumentValue as a simple container for the underlying value along with a flag for whether it was omitted or not. This could be used as an alternative to @Argument on controller method parameters, or nested within the structure of an @Argument object.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions