Skip to content

Add support for partial updates #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anttip
Copy link
Contributor

@anttip anttip commented Mar 17, 2025

Adds support for binding to java.util.Optional parameters. Binding to Optional parameters allows implementing partial updates. With a partial update the mutate call can update only some of the Optional fields without needing to repeat all the existing values of an object.

The mapping from an optional field in GraphQL schema that binds to java.util.Optional is the following:

  1. value given to the field in GraphQL call is mapped into java.util.Optional of the underlying type
  2. null given to the field in GraphQL call is mapped into Optional.empty to signal the removal of a possibly existing value of the field
  3. field not included in the GraphQL call is mapped into null to signal undefined so any possibly existing value(s) should not be modified

@Fgerthoffert
Copy link
Collaborator

Thank you for the PR @anttip,

After an initial look, this seems like a good idea, things are a bit busy on our end but we'll try to review that PR at some point in May (or earlier if we can).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants