-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Firestore: Fix FieldValue.arrayUnion() accept POJO. #5750
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
Conversation
|
This looks like it's okay to me. What do you think @schmidt-sebastian? |
schmidt-sebastian
left a comment
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.
Thanks for this! I left some feedback if you want to take this PR for another spin.
| ArrayValue.Builder encodedElements = ArrayValue.newBuilder(); | ||
|
|
||
| for (Object element : elements) { | ||
| Object data = CustomClassMapper.convertToPlainJavaTypes(element); |
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.
Can you make the same change for ArrayRemoveFieldValue?
| assertEquals(Timestamp.ofTimeSecondsAndNanos(0, 0), writeResult.getUpdateTime()); | ||
| } | ||
|
|
||
| private static class TestPoJo { |
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.
| ImmutableList.<Map<String, String>>of( | ||
| ImmutableMap.<String, String>of("test", "test-value")))); | ||
| WriteResult writeResult = doc.update("foo", fieldValue).get(); | ||
| assertEquals(Timestamp.ofTimeSecondsAndNanos(0, 0), writeResult.getUpdateTime()); |
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.
I know it would be a lot more code, but to me this test would be more valuable if it verified the generated proto.
Codecov Report
@@ Coverage Diff @@
## master #5750 +/- ##
===========================================
- Coverage 47.09% 46.79% -0.3%
- Complexity 25079 25648 +569
===========================================
Files 2389 2456 +67
Lines 259750 267615 +7865
Branches 29400 30563 +1163
===========================================
+ Hits 122328 125243 +2915
- Misses 128459 133113 +4654
- Partials 8963 9259 +296
Continue to review full report at Codecov.
|
|
@schmidt-sebastian PTAL |
schmidt-sebastian
left a comment
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.
@pmakani Thank you for addressing my feedback! This basically looks good, but I would like to tweak the tests slightly to better match the existing format. While you are essentially asserting the same things, we have been comparing the final CommitRequest rather than the outout from the toProto() calls.
Do you mind applying this patch to your PR: https://gist.github.com/schmidt-sebastian/08b8cf9956a33989a8eedaad4533d25d
We are then good to go! Thank you for your contribution.
|
@pmakani Thanks for the contribution! |
Fixes #5622