graphql-java-annotations icon indicating copy to clipboard operation
graphql-java-annotations copied to clipboard

Add support for partial updates

Open anttip opened this issue 8 months ago • 3 comments

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

anttip avatar Mar 17 '25 15:03 anttip

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).

Fgerthoffert avatar Apr 03 '25 09:04 Fgerthoffert

Sorry for the delay, we'll try to review it by the end of June.

Fgerthoffert avatar Jun 05 '25 09:06 Fgerthoffert

Thanks for the update! Looking forward to the review. Meanwhile I can report that we have been using it without issues from our fork since creation. Hope it makes it to the project and is useful for others as well.

anttip avatar Jun 05 '25 09:06 anttip

@Fgerthoffert Any updates on this?

anttip avatar Aug 04 '25 08:08 anttip

Apologies for the repeated delays, the past few months have been quite busy on our end. If everything goes as expected, we should review it within the next 2–3 weeks.

Fgerthoffert avatar Aug 11 '25 06:08 Fgerthoffert

Thank you for the review and suggestions @dgriffon!

anttip avatar Aug 25 '25 13:08 anttip

Thank you so much for your contribution! 🚀 Your work on adding support for partial updates is greatly appreciated. This enhancement will be valuable for the project and its users. Thank you for your time and effort in improving the codebase! 🙏

jkevan avatar Aug 27 '25 09:08 jkevan