Skip to content

Conversation

@suraj-qlogic
Copy link
Contributor

Fixes #288

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 15, 2020
@codecov
Copy link

codecov bot commented Jul 15, 2020

Codecov Report

Merging #295 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #295 +/- ## ============================================ + Coverage 72.98% 73.00% +0.02%  - Complexity 1044 1057 +13  ============================================ Files 64 64 Lines 5526 5531 +5 Branches 645 644 -1 ============================================ + Hits 4033 4038 +5  Misses 1282 1282 Partials 211 211 
Impacted Files Coverage Δ Complexity Δ
...main/java/com/google/cloud/firestore/BasePath.java 87.87% <100.00%> (+1.21%) 14.00 <1.00> (+2.00)
.../com/google/cloud/firestore/UserDataConverter.java 97.53% <100.00%> (+0.06%) 24.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b91c57c...f50a76d. Read the comment docs.

@suraj-qlogic suraj-qlogic added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 15, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 15, 2020
@suraj-qlogic
Copy link
Contributor Author

@schmidt-sebastian ,all the changes have been addressed PTAL

Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! Some nits.

for (Map.Entry<String, Object> entry : map.entrySet()) {
Value encodedValue = encodeValue(path.append(entry.getKey()), entry.getValue(), options);
Value encodedValue =
encodeValue(path.append(entry.getKey(), false), entry.getValue(), options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
encodeValue(path.append(entry.getKey(), false), entry.getValue(), options);
encodeValue(path.append(entry.getKey(), /* splitPath= */ false), entry.getValue(), options);

I generally prefer these inline comments for non-descriptive values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

FieldPath path = FieldPath.of("a.b", "c.d");
documentReference.update(path, FieldValue.delete()).get();
CommitRequest expectedCommit =
commit(update(new HashMap<String, Value>(), Arrays.asList("`a.b`.`c.d`")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
commit(update(new HashMap<String, Value>(), Arrays.asList("`a.b`.`c.d`")));
commit(update(Collections.<String, Value>emptyMap(), Collections.singletonList("`a.b`.`c.d`")));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 1278 to 1279
Map<String, Object> dotKeyMap = new HashMap<>();
dotKeyMap.put("a.b", SINGLE_FILED_MAP_WITH_DOT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Map<String, Object> dotKeyMap = new HashMap<>();
dotKeyMap.put("a.b", SINGLE_FILED_MAP_WITH_DOT);
Map<String, Object> dotKeyMap = map(""a.b"", SINGLE_FILED_MAP_WITH_DOT);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

documentReference.set(dotKeyMap).get();
DocumentSnapshot documentSnapshots = documentReference.get().get();
assertEquals(SINGLE_FILED_MAP_WITH_DOT, documentSnapshots.getData().get("a.b"));
FieldPath path = FieldPath.of("a.b", "c.d");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add empty line above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 1287 to 1294
Map<String, Object> nestedMap = new HashMap<>();
nestedMap.put("e", SINGLE_FILED_MAP_WITH_DOT);
dotKeyMap.put("a.b", nestedMap);
documentReference.set(dotKeyMap).get();
path = FieldPath.of("a.b", "e", "c.d");
documentReference.update(path, FieldValue.delete()).get();
documentSnapshots = documentReference.get().get();
assertNull(documentSnapshots.getData().get("c.d"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can delete this part as it doesn't expand on the tests coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@schmidt-sebastian schmidt-sebastian changed the title fix: add support for delete field key contain period fix: add support for deleting nested fields that contain periods Jul 16, 2020
@BenWhitehead BenWhitehead merged commit 84f602e into googleapis:master Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

5 participants