Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add Boolean fields to Data classes for supporting sparse update #664
Add Boolean fields to Data classes for supporting sparse update #664
Changes from 43 commits
3ca2c92
00750c2
5da690e
874e237
a189da3
39e4878
f21e6af
c10ceb9
caff38c
e178a13
ecdee83
36d06c0
3bae6d6
0ccf925
cd71b3a
909d1fc
7a1d567
b3513ef
b5c7af4
4052436
7fa7f2f
3279171
544cc66
ecdae30
f2025ed
e22b4cc
f4833f2
7274e31
2b01466
6a515b3
e8e60fa
5d76a5e
8513595
0cf86d3
0e8cc84
bab8c0e
659de3d
aa449b8
f3f16ac
258cb3b
2c4515e
dd0935d
9dec043
1e7bb05
8a83b91
3c076cc
228ce44
9cb3ec6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably cleaner to write this as:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kilink Fields are generated for all these cases:
Fields are generated for both nullable field with default value as well as non-nullable with default value might get assigned default values by initializer without direct request from the client. This is our understanding from existing graphql services leveraging sparse update solution. Having Boolean field for other cases will help identify values set by the client.
With this, I can update the double negative to simplify the logic:
if (it.isNullable && it.initialValue != null))
Is this acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no reason to generate fields for any of the cases except the first one: a nullable field with no defaults. For any case with a default value, it's impossible for DGS to tell if the value was explicitly supplied or not, graphql-java will hand us the variables with the default value already there. So the flag here would always be "true". The flag is pretty useless in that case and misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, updated to generate fields for nullable fields with no default values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I think the comment would be clearer if it was stated as what we want to generate the fields for, e.g.:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here as before, I would avoid that "double negative" and write this as:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
Otherwise it matches other fields that are similarly named and is incorrect.
e.g.
something
andisSomethingThere
..will generateisSomething
that conflicts withisSomethingThere
field.Also this is problematic if the field
isSomething
is also there as part of the schema.