-
Notifications
You must be signed in to change notification settings - Fork 373
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
Fix Firestore conformance tests #5344
Conversation
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.
I've added the do not merge
label and won't really approve so we don't accidentally merge before we have confirmation.
Note: using the precondition to determine whether or not to use an empty update mask may not be a good idea. It may be as simple as depending on which method is calling it (so just have an extra flag...) |
Deciding when to use an update mask is currently slightly tricky, and may be simplified a bit later when we have more detailed specifications.
We don't need the concept of "should we include the write result or not" any more.
- Create never specifies an update mask - Set specifies an update mask if and only if the merge option is true - Update always specifies an update mask In all cases there's a single Write (so I've renamed the method). All tests still pass, and I'm now happy to merge this.
94b8fc4
to
d099662
Compare
Amanda: I've added an extra commit to this based on internal guidance. Please could you have a look? If you're happy, we can merge this and we're done :) |
@@ -264,7 +244,9 @@ internal async Task<IList<WriteResult>> CommitAsync(ByteString transactionId, Ca | |||
Fields = { fields }, | |||
Name = documentReference.Path, | |||
}, | |||
UpdateMask = includeEmptyUpdateMask || updatePaths.Count > 0 ? new DocumentMask { FieldPaths = { updatePaths.Select(fp => fp.EncodedPath) } } : null, | |||
UpdateMask = updatePaths is null |
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 could compute the DocumentMask (or null) outside the object initializer if you'd prefer.
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.
No, this is fine.
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.
Yep, so much cleaner.
@@ -264,7 +244,9 @@ internal async Task<IList<WriteResult>> CommitAsync(ByteString transactionId, Ca | |||
Fields = { fields }, | |||
Name = documentReference.Path, | |||
}, | |||
UpdateMask = includeEmptyUpdateMask || updatePaths.Count > 0 ? new DocumentMask { FieldPaths = { updatePaths.Select(fp => fp.EncodedPath) } } : null, | |||
UpdateMask = updatePaths is null |
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.
No, this is fine.
Fixes #5343.
This should not be merged until we've seen a spec for update transforms.