-
Notifications
You must be signed in to change notification settings - Fork 317
GraphQlArgumentInstantiator support for patchable arguments #228
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
Comments
This is being discussed as well in #140. Could you tell us more about this? How would you model that at the type level? How would you persist that with your entities/repository? |
Indeed there doesn't seem to be a built-in type, so we've had to implement our own 'tri state' type, where the state can be 'update', 'delete', or 'ignore'.
We use a custom deserialiser in Jackson that can deserialise from JSON to models with this type.
The An example of persistence is using SQL. If the provided model has a field which is 'ignore', we do not generate a SQL SET statement for that field, thereby ignoring any updates to that field. |
This looks similar to the use case in #140, but different implementation. Thanks for the snippet. It shows how you deserialize but it's not clear how this is used? For example is For a potential solution in more detail:
|
Do you know if a native implementation of patchable/partial update is planned for the next releases of Spring Boot GraphQL ? (tell me if there is already a place listing future changes) thx 🙏 |
This comment was marked as duplicate.
This comment was marked as duplicate.
@noogatiix you can subscribe to this issue to learn about updates. As you can see in this conversation and linked issues, there isn't a generic approach that would work for all use cases described so far. The expected behavior, how you're combining this with other existing libraries (serialization, persistence) and the fact that this concept doesn't exist in Java - this makes it hard to find an approach that would work for all. We're not likely to provide such a feature for the 1.0.0 version but we'll keep looking at this space. |
@dchan4 and @noogatiix, we've addressed this with the changes under #518. Please, take a look and provide any further comments or feedback there. |
Thank you very much for addressing this issue @rstoyanchev In the method However in the method Would it be possible to fix this? |
@zemanstano it's really hard to follow this explanation in an issue comment. Could you share a sample project that demonstrates a concrete problem? |
@zemanstano I think what you're raising was addressed yesterday with #553. |
@rstoyanchev yes, thank you, #553 would fix the problem I described |
Currently using the
@Argument
annotation it is not possible to tell if a field was not provided, or provided with a null. For example given 2 inputsand
the
org.springframework.graphql.data.method.annotation.support.GraphQlArgumentInstantiator#instantiate
method will instantiate thename
property tonull
in both cases.The use case for this is to implement patchable mutations e.g. if the
name
field is not provided, do not update it.Workaround is to not use
@Argument
and implement custom deserialisation using the data fetching environment directly.The text was updated successfully, but these errors were encountered: