-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Firestore: Port @DocumentId to server SDK #5743
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
BenWhitehead
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.
A few small questions, nothing major.
I assume this is being ported from the android SDK, is there a bread crumb we can to that implementation for a record of where this code is coming from?
| return data == null ? null : CustomClassMapper.convertToCustomClass(getData(), valueType); | ||
| return data == null | ||
| ? null | ||
| : CustomClassMapper.convertToCustomClass(getData(), valueType, docRef); |
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.
Is it valid to pass data in here, rather than calling getData() again?
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.
Yes,
| import java.util.Map; | ||
|
|
||
| /** A set of utilities for tests */ | ||
| public class TestUtil { |
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 this be package local since it's only used for firestore tests?
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.
Done.
| <artifactId>jackson-databind</artifactId> | ||
| <version>2.9.8</version> | ||
| <scope>test</scope> | ||
| </dependency> |
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.
Duplicate dependency declaration, and formatting in consistent with the rest of the file.
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.
Fixed.
| } | ||
|
|
||
| /** Holds information a deserialization operation needs to complete the job. */ | ||
| static class DeserializeContext { |
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.
Any reason this is package-private instead of private?
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.
Fixed.
Codecov Report
@@ Coverage Diff @@
## master #5743 +/- ##
============================================
+ Coverage 46.42% 47.17% +0.75%
- Complexity 23633 25115 +1482
============================================
Files 2389 2389
Lines 254506 259831 +5325
Branches 28467 29420 +953
============================================
+ Hits 118144 122582 +4438
- Misses 127547 128321 +774
- Partials 8815 8928 +113
Continue to review full report at Codecov.
|
ghost
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.
The best doc i can find explaining this is https://docs.google.com/document/d/1seUfCzHSv7WXJgoJrtVMCh36HTco7lIrMHZlwCErs40/edit?usp=sharing
Requires corp account to view.
| <artifactId>jackson-databind</artifactId> | ||
| <version>2.9.8</version> | ||
| <scope>test</scope> | ||
| </dependency> |
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.
Fixed.
| return data == null ? null : CustomClassMapper.convertToCustomClass(getData(), valueType); | ||
| return data == null | ||
| ? null | ||
| : CustomClassMapper.convertToCustomClass(getData(), valueType, docRef); |
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.
Yes,
| import java.util.Map; | ||
|
|
||
| /** A set of utilities for tests */ | ||
| public class TestUtil { |
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.
Done.
| } | ||
|
|
||
| /** Holds information a deserialization operation needs to complete the job. */ | ||
| static class DeserializeContext { |
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.
Fixed.
|
Thanks for addressing my comments and adding the link to the doc @hui-wu. Can you run the code formatter again, that is one of the builds that are currently failing. |
| import java.util.Map; | ||
|
|
||
| /** A set of utilities for tests */ | ||
| class TestUtil { |
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 is already a TestUtil: https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java
Please move your helper to this class. Thanks!
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.
Done.
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.
LGTM, but please merge the two TestUtil classes.
Also add MapperTests.