-
Notifications
You must be signed in to change notification settings - Fork 297
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
Adding the ability to call input object setter methods if they exist, falling back to direct field access. #1094
Adding the ability to call input object setter methods if they exist, falling back to direct field access. #1094
Conversation
c06a806
to
1d4f9cc
Compare
@ehardy thanks for the PR! Our CI is getting stuck, not sure why, so the builds are failing. Will try to address this soon. I haven't had time to deeply walk through the changes, but a few things come to mind...
|
Thanks @berngp for the feedback! Here are my thoughts about your questions:
Let me know what you think! |
Thanks @ehardy for the reply, and again thanks for the PR.
It might be worth also creating a benchmark like this. |
I like the idea of a benchmark, let's get actual numbers, will look into that. Also, I have started working on an alternate version of |
Hello @berngp , just a quick update on progress. I have managed to rework the implementation of |
Hi @ehardy , thanks for all the effort in the PR. Could you please push a branch when you have the chance? I'm a bit worried you are having to re-implement a lot due my previous suggestion. Would like to get an idea on the scope of the work. |
Hey @berngp , I found how to deal with the situation I described above. It seems that in class hierarchies, not all As I was reviewing before pushing this last set of changes, I thought of a small variation that might be more elegant. If you notice in this version of As usual, let me know what you think of all of that! I haven't gotten to implement the benchmark as you suggested. Will look into it. |
@berngp Here's this 3rd alternate version that I alluded to in my previous comment. |
@ehardy, haven't been able to review but will do early next week. Happy to add the benchmarks so we can have a better understanding of degradation, if any. |
Hello @berngp , have you had the time to review the different alternatives? Let me know which one, if any, would be the preferred one and if any changes are required. |
@ehardy very sorry for the delay, will look into this in the following days so we can merge it soon. |
Hello @berngp , did you get a chance to look into this? Anything I could help further with? |
Hi all, we are using the framework (which is great by the way) and we were really looking forward to progress on this as we work with mutations in a similar manner. Essentially, similar to a PATCH, data fields are ignored if they are not in the request but the presence of a value or an explicit null either updates the value or removes it from the DB. Obviously accessing mutations via your library is not functioning correctly as things currently stand so I guess my questions are... a) Has this been, or is due to be, released? Thanks in advance. |
@geordiegeoff - I'm not sure I understand the issue you are having with mutations. That said, could you please try with the latest 7.x version of the DGS framework? We did make changes over the past year wrt how input field mapping works, so maybe give it a try? If you still see issues, could you please open a new issue with the description of problem you are experiencing and steps to reproduce, that would be very helpful. |
Hello @srinivasankavitha, the problem, described in #1088, is that DGS does not distinguish between input fields that were explicitly set to We are using DGS 7.x and as far as I can tell the issue is still present. Would be happy to refresh the PR if all of this still makes sense, let me know. |
So the issue is exactly as @ehardy eloquently describes. We may be able to schedule in a version update but it appears that the problem still stands so would not be a solution. Essentially we have had to implement a fairly 'hacky' workaround in which we...
Not the most elegant solution but it works, mainly thanks to your support for Map serialization... |
Thanks @ehardy and @geordiegeoff. That makes sense to me, and appreciate your patience with this discussion. @ehardy - I like your solution of using a strategy to determine this behavior so we don't break compatibility with existing behavior. If you are able to refresh the PR for the latest code, I'd be happy to review and test. We won't be able to prioritize this fix for this quarter, but any help would be greatly appreciated! |
Sure thing! Also need to find some time, but will get to it 😁 Thank you @srinivasankavitha |
1d4f9cc
to
4c5f71b
Compare
@srinivasankavitha I have refreshed the PR from latest master branch, please have a look at your convenience. As I had mentioned, I'm not too well versed in Kotlin, so my implementation might feel too Java-ish 😁 Something that had been mentioned in my previous exchanges on the PR was to implement a JMH benchmark. Do you think it would be useful/necessary? Let me know. |
Thanks for the updates, will review this week. |
@kilink - would appreciate your input on this PR as well when you get a chance. |
4c5f71b
to
e8f4afd
Compare
Hello, I refreshed the branch from last master. Is there anything else needed to move this forward? Let me know. |
Any updates that could be shared? |
Hey @ehardy, thank you for the PR and apologies for the slow movement on this. There is a larger refactor of the |
Sounds good @kilink. About your comment about using Spring's I'll keep monitoring. Please keep this thread updated once the refactor lands. |
Very nice @kilink ! Will look updating this PR shortly. |
e8f4afd
to
ff4966e
Compare
@kilink I have updated the implementation following your recent changes in |
graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/PropertySetter.kt
Outdated
Show resolved
Hide resolved
graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/PropertySetter.kt
Outdated
Show resolved
Hide resolved
2e70a2d
to
af9725e
Compare
Thanks for the feedback @kilink! I have addressed comments and updated the PR. Would it be possible to have another look? |
LGTM! Thanks for bearing with me there, I know this process took a while. I appreciate the contribution! |
… falling back to direct field access.
c4136d9
to
6608dfa
Compare
I have rebased the PR. What else is required in order to get it merged? |
I asked @srinivasankavitha to take a look as well. Looks like the build is failing due to a lint error, you should be able to fix it just by running |
The changes look great to me. Thanks for all the work and your patience through the process. As @kilink mentioned, there is a lint error, but we can merge as soon as we have a green build |
Lint error has been fixed, hopefully the build passes now. Build and tests pass locally. Thanks for the feedback throughout. |
As per the discussion in #1088
Pull request checklist
first
Pull Request type
Changes in this PR
Adding the ability in
DefaultInputObjectMapper
to call setter methods if they exist on input objects, falling back to the current behaviour of setting fields directly.Alternatives considered
None