Repository: googleapis/python-firestore

Issue:
Update cross-language conformance tests to latest spec
PR #205 re-enabled the `tests/unit/v1/test_cross_language.py` test suite, but did not pull in the latest versions of the [conformance test data files](https://github.com/googleapis/conformance-tests/commit/0bb8520e48c35b3e0dd45c328a1b38be35664b91), specifically using the new [`update_transform` feature](https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1#google.firestore.v1.Write.FIELDS.repeated.google.firestore.v1.DocumentTransform.FieldTransform.google.firestore.v1.Write.update_transforms).

To do:

- [ ] Run `make -f Makefile_v1 copy-testdata`.  Verify that tests of updates fail.
- [ ] Update explicit unit tests and code for update-related methods to bundle values previously packed into separate `transform` messages into the `update_transforms` sub-message of the `update` message.  Verify that conftests now pass.


Discussion:
tseaver: Note to reviewers:  commit-by-commit is likely easier than all-at-once:  the last commit is just the "copy current JSON files" bit, which doesn't really need review.

Patch:
diff --git a/google/cloud/firestore_v1/_helpers.py b/google/cloud/firestore_v1/_helpers.py
index f9f01e7..e98ec85 100644
--- a/google/cloud/firestore_v1/_helpers.py
+++ b/google/cloud/firestore_v1/_helpers.py
@@ -495,7 +495,9 @@ class DocumentExtractor(object):
 
         return update_pb
 
-    def get_transform_pb(self, document_path, exists=None) -> types.write.Write:
+    def get_field_transform_pbs(
+        self, document_path
+    ) -> List[types.write.DocumentTransform.FieldTransform]:
         def make_array_value(values):
             value_list = [encode_value(element) for element in values]
             return document.ArrayValue(values=value_list)
@@ -559,9 +561,10 @@ class DocumentExtractor(object):
                 for path, value in self.minimums.items()
             ]
         )
-        field_transforms = [
-            transform for path, transform in sorted(path_field_transforms)
-        ]
+        return [transform for path, transform in sorted(path_field_transforms)]
+
+    def get_transform_pb(self, document_path, exists=None) -> types.write.Write:
+        field_transforms = self.get_field_transform_pbs(document_path)
         transform_pb = write.Write(
             transform=write.DocumentTransform(
                 document=document_path, field_transforms=field_transforms
@@ -592,19 +595,13 @@ def pbs_for_create(document_path, document_data) -> List[types.write.Write]:
     if extractor.deleted_fields:
         raise ValueError("Cannot apply DELETE_FIELD in a create request.")
 
-    write_pbs = []
-
-    # Conformance tests require skipping the 'update_pb' if the document
-    # contains only transforms.
-    if extractor.empty_document or extractor.set_fields:
-        write_pbs.append(extractor.get_update_pb(document_path, exists=False))
+    create_pb = extractor.get_update_pb(document_path, exists=False)
 
     if extractor.has_transforms:
-        exists = None if write_pbs else False
-        transform_pb = extractor.get_transform_pb(document_path, exists)
-        write_pbs.append(transform_pb)
+        field_transform_pbs = extractor.get_field_transform_pbs(document_path)
+        create_pb.update_transforms.extend(field_transform_pbs)
 
-    return write_pbs
+    return [create_pb]
 
 
 def pbs_for_set_no_merge(document_path, document_data) -> List[types.write.Write]:
@@ -627,15 +624,13 @@ def pbs_for_set_no_merge(document_path, document_data) -> List[types.write.Write
             "specifying 'merge=True' or 'merge=[field_paths]'."
         )
 
-    # Conformance tests require send the 'update_pb' even if the document
-    # contains only transforms.
-    write_pbs = [extractor.get_update_pb(document_path)]
+    set_pb = extractor.get_update_pb(document_path)
 
     if extractor.has_transforms:
-        transform_pb = extractor.get_transform_pb(document_path)
-        write_pbs.append(transform_pb)
+        field_transform_pbs = extractor.get_field_transform_pbs(document_path)
+        set_pb.update_transforms.extend(field_transform_pbs)
 
-    return write_pbs
+    return [set_pb]
 
 
 class DocumentExtractorForMerge(DocumentExtractor):
@@ -799,19 +794,14 @@ def pbs_for_set_with_merge(
     extractor.apply_merge(merge)
 
     merge_empty = not document_data
+    allow_empty_mask = merge_empty or extractor.transform_paths
 
-    write_pbs = []
-
-    if extractor.has_updates or merge_empty:
-        write_pbs.append(
-            extractor.get_update_pb(document_path, allow_empty_mask=merge_empty)
-        )
-
+    set_pb = extractor.get_update_pb(document_path, allow_empty_mask=allow_empty_mask)
     if extractor.transform_paths:
-        transform_pb = extractor.get_transform_pb(document_path)
-        write_pbs.append(transform_pb)
+        field_transform_pbs = extractor.get_field_transform_pbs(document_path)
+        set_pb.update_transforms.extend(field_transform_pbs)
 
-    return write_pbs
+    return [set_pb]
 
 
 class DocumentExtractorForUpdate(DocumentExtractor):
@@ -876,22 +866,14 @@ def pbs_for_update(document_path, field_updates, option) -> List[types.write.Wri
     if option is None:  # Default is to use ``exists=True``.
         option = ExistsOption(exists=True)
 
-    write_pbs = []
-
-    if extractor.field_paths or extractor.deleted_fields:
-        update_pb = extractor.get_update_pb(document_path)
-        option.modify_write(update_pb)
-        write_pbs.append(update_pb)
+    update_pb = extractor.get_update_pb(document_path)
+    option.modify_write(update_pb)
 
     if extractor.has_transforms:
-        transform_pb = extractor.get_transform_pb(document_path)
-        if not write_pbs:
-            # NOTE: set the write option on the ``transform_pb`` only if there
-            #       is no ``update_pb``
-            option.modify_write(transform_pb)
-        write_pbs.append(transform_pb)
-
-    return write_pbs
+        field_transform_pbs = extractor.get_field_transform_pbs(document_path)
+        update_pb.update_transforms.extend(field_transform_pbs)
+
+    return [update_pb]
 
 
 def pb_for_delete(document_path, option) -> types.write.Write:


Test patch:
diff --git a/tests/unit/v1/test__helpers.py b/tests/unit/v1/test__helpers.py
index 55b74f8..c51084a 100644
--- a/tests/unit/v1/test__helpers.py
+++ b/tests/unit/v1/test__helpers.py
@@ -1270,6 +1270,38 @@ class TestDocumentExtractor(unittest.TestCase):
         self.assertEqual(update_pb.update.fields, encode_dict(document_data))
         self.assertFalse(update_pb._pb.HasField("current_document"))
 
+    def test_get_field_transform_pbs_miss(self):
+        document_data = {"a": 1}
+        inst = self._make_one(document_data)
+        document_path = (
+            "projects/project-id/databases/(default)/" "documents/document-id"
+        )
+
+        field_transform_pbs = inst.get_field_transform_pbs(document_path)
+
+        self.assertEqual(field_transform_pbs, [])
+
+    def test_get_field_transform_pbs_w_server_timestamp(self):
+        from google.cloud.firestore_v1.types import write
+        from google.cloud.firestore_v1.transforms import SERVER_TIMESTAMP
+        from google.cloud.firestore_v1._helpers import REQUEST_TIME_ENUM
+
+        document_data = {"a": SERVER_TIMESTAMP}
+        inst = self._make_one(document_data)
+        document_path = (
+            "projects/project-id/databases/(default)/" "documents/document-id"
+        )
+
+        field_transform_pbs = inst.get_field_transform_pbs(document_path)
+
+        self.assertEqual(len(field_transform_pbs), 1)
+        field_transform_pb = field_transform_pbs[0]
+        self.assertIsInstance(
+            field_transform_pb, write.DocumentTransform.FieldTransform
+        )
+        self.assertEqual(field_transform_pb.field_path, "a")
+        self.assertEqual(field_transform_pb.set_to_server_value, REQUEST_TIME_ENUM)
+
     def test_get_transform_pb_w_server_timestamp_w_exists_precondition(self):
         from google.cloud.firestore_v1.types import write
         from google.cloud.firestore_v1.transforms import SERVER_TIMESTAMP
@@ -1526,23 +1558,16 @@ class Test_pbs_for_create(unittest.TestCase):
         )
 
     @staticmethod
-    def _make_write_w_transform(document_path, fields):
-        from google.cloud.firestore_v1.types import write
+    def _add_field_transforms(update_pb, fields):
         from google.cloud.firestore_v1 import DocumentTransform
 
         server_val = DocumentTransform.FieldTransform.ServerValue
-        transforms = [
-            write.DocumentTransform.FieldTransform(
-                field_path=field, set_to_server_value=server_val.REQUEST_TIME
-            )
-            for field in fields
-        ]
-
-        return write.Write(
-            transform=write.DocumentTransform(
-                document=document_path, field_transforms=transforms
+        for field in fields:
+            update_pb.update_transforms.append(
+                DocumentTransform.FieldTransform(
+                    field_path=field, set_to_server_value=server_val.REQUEST_TIME
+                )
             )
-        )
 
     def _helper(self, do_transform=False, empty_val=False):
         from google.cloud.firestore_v1.transforms import SERVER_TIMESTAMP
@@ -1569,9 +1594,7 @@ class Test_pbs_for_create(unittest.TestCase):
         expected_pbs = [update_pb]
 
         if do_transform:
-            expected_pbs.append(
-                self._make_write_w_transform(document_path, fields=["butter"])
-            )
+            self._add_field_transforms(update_pb, fields=["butter"])
 
         self.assertEqual(write_pbs, expected_pbs)
 
@@ -1603,23 +1626,16 @@ class Test_pbs_for_set_no_merge(unittest.TestCase):
         )
 
     @staticmethod
-    def _make_write_w_transform(document_path, fields):
-        from google.cloud.firestore_v1.types import write
+    def _add_field_transforms(update_pb, fields):
         from google.cloud.firestore_v1 import DocumentTransform
 
         server_val = DocumentTransform.FieldTransform.ServerValue
-        transforms = [
-            write.DocumentTransform.FieldTransform(
-                field_path=field, set_to_server_value=server_val.REQUEST_TIME
-            )
-            for field in fields
-        ]
-
-        return write.Write(
-            transform=write.DocumentTransform(
-                document=document_path, field_transforms=transforms
+        for field in fields:
+            update_pb.update_transforms.append(
+                DocumentTransform.FieldTransform(
+                    field_path=field, set_to_server_value=server_val.REQUEST_TIME
+                )
             )
-        )
 
     def test_w_empty_document(self):
         document_path = _make_ref_string(u"little", u"town", u"of", u"ham")
@@ -1640,8 +1656,8 @@ class Test_pbs_for_set_no_merge(unittest.TestCase):
         write_pbs = self._call_fut(document_path, document_data)
 
         update_pb = self._make_write_w_document(document_path)
-        transform_pb = self._make_write_w_transform(document_path, ["butter"])
-        expected_pbs = [update_pb, transform_pb]
+        self._add_field_transforms(update_pb, fields=["butter"])
+        expected_pbs = [update_pb]
         self.assertEqual(write_pbs, expected_pbs)
 
     def _helper(self, do_transform=False, empty_val=False):
@@ -1669,9 +1685,7 @@ class Test_pbs_for_set_no_merge(unittest.TestCase):
         expected_pbs = [update_pb]
 
         if do_transform:
-            expected_pbs.append(
-                self._make_write_w_transform(document_path, fields=["butter"])
-            )
+            self._add_field_transforms(update_pb, fields=["butter"])
 
         self.assertEqual(write_pbs, expected_pbs)
 
@@ -1904,23 +1918,16 @@ class Test_pbs_for_set_with_merge(unittest.TestCase):
         )
 
     @staticmethod
-    def _make_write_w_transform(document_path, fields):
-        from google.cloud.firestore_v1.types import write
+    def _add_field_transforms(update_pb, fields):
         from google.cloud.firestore_v1 import DocumentTransform
 
         server_val = DocumentTransform.FieldTransform.ServerValue
-        transforms = [
-            write.DocumentTransform.FieldTransform(
-                field_path=field, set_to_server_value=server_val.REQUEST_TIME
-            )
-            for field in fields
-        ]
-
-        return write.Write(
-            transform=write.DocumentTransform(
-                document=document_path, field_transforms=transforms
+        for field in fields:
+            update_pb.update_transforms.append(
+                DocumentTransform.FieldTransform(
+                    field_path=field, set_to_server_value=server_val.REQUEST_TIME
+                )
             )
-        )
 
     @staticmethod
     def _update_document_mask(update_pb, field_paths):
@@ -1954,6 +1961,20 @@ class Test_pbs_for_set_with_merge(unittest.TestCase):
         expected_pbs = [update_pb]
         self.assertEqual(write_pbs, expected_pbs)
 
+    def test_with_merge_true_w_only_transform(self):
+        from google.cloud.firestore_v1.transforms import SERVER_TIMESTAMP
+
+        document_path = _make_ref_string(u"little", u"town", u"of", u"ham")
+        document_data = {"butter": SERVER_TIMESTAMP}
+
+        write_pbs = self._call_fut(document_path, document_data, merge=True)
+
+        update_pb = self._make_write_w_document(document_path)
+        self._update_document_mask(update_pb, field_paths=())
+        self._add_field_transforms(update_pb, fields=["butter"])
+        expected_pbs = [update_pb]
+        self.assertEqual(write_pbs, expected_pbs)
+
     def test_with_merge_true_w_transform(self):
         from google.cloud.firestore_v1.transforms import SERVER_TIMESTAMP
 
@@ -1966,8 +1987,8 @@ class Test_pbs_for_set_with_merge(unittest.TestCase):
 
         update_pb = self._make_write_w_document(document_path, **update_data)
         self._update_document_mask(update_pb, field_paths=sorted(update_data))
-        transform_pb = self._make_write_w_transform(document_path, fields=["butter"])
-        expected_pbs = [update_pb, transform_pb]
+        self._add_field_transforms(update_pb, fields=["butter"])
+        expected_pbs = [update_pb]
         self.assertEqual(write_pbs, expected_pbs)
 
     def test_with_merge_field_w_transform(self):
@@ -1986,8 +2007,8 @@ class Test_pbs_for_set_with_merge(unittest.TestCase):
             document_path, cheese=document_data["cheese"]
         )
         self._update_document_mask(update_pb, ["cheese"])
-        transform_pb = self._make_write_w_transform(document_path, fields=["butter"])
-        expected_pbs = [update_pb, transform_pb]
+        self._add_field_transforms(update_pb, fields=["butter"])
+        expected_pbs = [update_pb]
         self.assertEqual(write_pbs, expected_pbs)
 
     def test_with_merge_field_w_transform_masking_simple(self):
@@ -2001,10 +2022,9 @@ class Test_pbs_for_set_with_merge(unittest.TestCase):
         write_pbs = self._call_fut(document_path, document_data, merge=["butter.pecan"])
 
         update_pb = self._make_write_w_document(document_path)
-        transform_pb = self._make_write_w_transform(
-            document_path, fields=["butter.pecan"]
-        )
-        expected_pbs = [update_pb, transform_pb]
+        self._update_document_mask(update_pb, field_paths=())
+        self._add_field_transforms(update_pb, fields=["butter.pecan"])
+        expected_pbs = [update_pb]
         self.assertEqual(write_pbs, expected_pbs)
 
     def test_with_merge_field_w_transform_parent(self):
@@ -2023,10 +2043,8 @@ class Test_pbs_for_set_with_merge(unittest.TestCase):
             document_path, cheese=update_data["cheese"], butter={"popcorn": "yum"}
         )
         self._update_document_mask(update_pb, ["cheese", "butter"])
-        transform_pb = self._make_write_w_transform(
-            document_path, fields=["butter.pecan"]
-        )
-        expected_pbs = [update_pb, transform_pb]
+        self._add_field_transforms(update_pb, fields=["butter.pecan"])
+        expected_pbs = [update_pb]
         self.assertEqual(write_pbs, expected_pbs)
 
 
@@ -2134,23 +2152,19 @@ class Test_pbs_for_update(unittest.TestCase):
         if isinstance(option, _helpers.ExistsOption):
             precondition = common.Precondition(exists=False)
             expected_update_pb._pb.current_document.CopyFrom(precondition._pb)
-        expected_pbs = [expected_update_pb]
+
         if do_transform:
             transform_paths = FieldPath.from_string(field_path2)
             server_val = DocumentTransform.FieldTransform.ServerValue
-            expected_transform_pb = write.Write(
-                transform=write.DocumentTransform(
-                    document=document_path,
-                    field_transforms=[
-                        write.DocumentTransform.FieldTransform(
-                            field_path=transform_paths.to_api_repr(),
-                            set_to_server_value=server_val.REQUEST_TIME,
-                        )
-                    ],
+            field_transform_pbs = [
+                write.DocumentTransform.FieldTransform(
+                    field_path=transform_paths.to_api_repr(),
+                    set_to_server_value=server_val.REQUEST_TIME,
                 )
-            )
-            expected_pbs.append(expected_transform_pb)
-        self.assertEqual(write_pbs, expected_pbs)
+            ]
+            expected_update_pb.update_transforms.extend(field_transform_pbs)
+
+        self.assertEqual(write_pbs, [expected_update_pb])
 
     def test_without_option(self):
         from google.cloud.firestore_v1.types import common
diff --git a/tests/unit/v1/testdata/create-all-transforms.json b/tests/unit/v1/testdata/create-all-transforms.json
index 8283162..6389599 100644
--- a/tests/unit/v1/testdata/create-all-transforms.json
+++ b/tests/unit/v1/testdata/create-all-transforms.json
@@ -20,50 +20,45 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  },
-                  {
-                    "fieldPath": "c",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "d",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                },
+                {
+                  "fieldPath": "c",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "d",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-arrayremove-multi.json b/tests/unit/v1/testdata/create-arrayremove-multi.json
index 548a983..331a53b 100644
--- a/tests/unit/v1/testdata/create-arrayremove-multi.json
+++ b/tests/unit/v1/testdata/create-arrayremove-multi.json
@@ -20,46 +20,41 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "c.d",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-arrayremove-nested.json b/tests/unit/v1/testdata/create-arrayremove-nested.json
index fa01bd7..00c73d0 100644
--- a/tests/unit/v1/testdata/create-arrayremove-nested.json
+++ b/tests/unit/v1/testdata/create-arrayremove-nested.json
@@ -20,30 +20,25 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-arrayremove.json b/tests/unit/v1/testdata/create-arrayremove.json
index a69be14..646e259 100644
--- a/tests/unit/v1/testdata/create-arrayremove.json
+++ b/tests/unit/v1/testdata/create-arrayremove.json
@@ -20,30 +20,25 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-arrayunion-multi.json b/tests/unit/v1/testdata/create-arrayunion-multi.json
index 7ca9852..5ba324f 100644
--- a/tests/unit/v1/testdata/create-arrayunion-multi.json
+++ b/tests/unit/v1/testdata/create-arrayunion-multi.json
@@ -20,46 +20,41 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "c.d",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-arrayunion-nested.json b/tests/unit/v1/testdata/create-arrayunion-nested.json
index a2f2029..2a21509 100644
--- a/tests/unit/v1/testdata/create-arrayunion-nested.json
+++ b/tests/unit/v1/testdata/create-arrayunion-nested.json
@@ -20,30 +20,25 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-arrayunion.json b/tests/unit/v1/testdata/create-arrayunion.json
index 26d0799..99a75fe 100644
--- a/tests/unit/v1/testdata/create-arrayunion.json
+++ b/tests/unit/v1/testdata/create-arrayunion.json
@@ -20,30 +20,25 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-st-alone.json b/tests/unit/v1/testdata/create-st-alone.json
index 20c5e8e..1772939 100644
--- a/tests/unit/v1/testdata/create-st-alone.json
+++ b/tests/unit/v1/testdata/create-st-alone.json
@@ -10,18 +10,19 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              },
               "currentDocument": {
                 "exists": false
-              }
+              },
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-st-multi.json b/tests/unit/v1/testdata/create-st-multi.json
index 89430e2..41f3cd8 100644
--- a/tests/unit/v1/testdata/create-st-multi.json
+++ b/tests/unit/v1/testdata/create-st-multi.json
@@ -20,22 +20,17 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                },
+                {
+                  "fieldPath": "c.d",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-st-nested.json b/tests/unit/v1/testdata/create-st-nested.json
index f2a3a8d..7316d91 100644
--- a/tests/unit/v1/testdata/create-st-nested.json
+++ b/tests/unit/v1/testdata/create-st-nested.json
@@ -20,18 +20,13 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-st-with-empty-map.json b/tests/unit/v1/testdata/create-st-with-empty-map.json
index 730afd1..b638a0c 100644
--- a/tests/unit/v1/testdata/create-st-with-empty-map.json
+++ b/tests/unit/v1/testdata/create-st-with-empty-map.json
@@ -28,18 +28,13 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/create-st.json b/tests/unit/v1/testdata/create-st.json
index 705f76e..c4ad4be 100644
--- a/tests/unit/v1/testdata/create-st.json
+++ b/tests/unit/v1/testdata/create-st.json
@@ -20,18 +20,13 @@
               },
               "currentDocument": {
                 "exists": false
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-all-transforms.json b/tests/unit/v1/testdata/set-all-transforms.json
index 5c8b137..a26b51b 100644
--- a/tests/unit/v1/testdata/set-all-transforms.json
+++ b/tests/unit/v1/testdata/set-all-transforms.json
@@ -17,50 +17,45 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  },
-                  {
-                    "fieldPath": "c",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "d",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                },
+                {
+                  "fieldPath": "c",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
+                  }
+                },
+                {
+                  "fieldPath": "d",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-arrayremove-multi.json b/tests/unit/v1/testdata/set-arrayremove-multi.json
index 3ea9b0d..dc2ace2 100644
--- a/tests/unit/v1/testdata/set-arrayremove-multi.json
+++ b/tests/unit/v1/testdata/set-arrayremove-multi.json
@@ -17,46 +17,41 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
+                  }
+                },
+                {
+                  "fieldPath": "c.d",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-arrayremove-nested.json b/tests/unit/v1/testdata/set-arrayremove-nested.json
index 4db133f..1e25b8f 100644
--- a/tests/unit/v1/testdata/set-arrayremove-nested.json
+++ b/tests/unit/v1/testdata/set-arrayremove-nested.json
@@ -17,30 +17,25 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-arrayremove.json b/tests/unit/v1/testdata/set-arrayremove.json
index 18969ef..e0506b2 100644
--- a/tests/unit/v1/testdata/set-arrayremove.json
+++ b/tests/unit/v1/testdata/set-arrayremove.json
@@ -17,30 +17,25 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-arrayunion-multi.json b/tests/unit/v1/testdata/set-arrayunion-multi.json
index 3d07639..502d7dc 100644
--- a/tests/unit/v1/testdata/set-arrayunion-multi.json
+++ b/tests/unit/v1/testdata/set-arrayunion-multi.json
@@ -17,46 +17,41 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
+                  }
+                },
+                {
+                  "fieldPath": "c.d",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-arrayunion-nested.json b/tests/unit/v1/testdata/set-arrayunion-nested.json
index e265f6c..7084e6b 100644
--- a/tests/unit/v1/testdata/set-arrayunion-nested.json
+++ b/tests/unit/v1/testdata/set-arrayunion-nested.json
@@ -17,30 +17,25 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-arrayunion.json b/tests/unit/v1/testdata/set-arrayunion.json
index 856e075..af12b33 100644
--- a/tests/unit/v1/testdata/set-arrayunion.json
+++ b/tests/unit/v1/testdata/set-arrayunion.json
@@ -17,30 +17,25 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-alone-mergeall.json b/tests/unit/v1/testdata/set-st-alone-mergeall.json
index d95bf09..f6b60af 100644
--- a/tests/unit/v1/testdata/set-st-alone-mergeall.json
+++ b/tests/unit/v1/testdata/set-st-alone-mergeall.json
@@ -13,15 +13,19 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-alone.json b/tests/unit/v1/testdata/set-st-alone.json
index 3fe9313..1d28fd6 100644
--- a/tests/unit/v1/testdata/set-st-alone.json
+++ b/tests/unit/v1/testdata/set-st-alone.json
@@ -13,18 +13,13 @@
               "update": {
                 "name": "projects/projectID/databases/(default)/documents/C/d",
                 "fields": {}
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-merge-both.json b/tests/unit/v1/testdata/set-st-merge-both.json
index a39ada5..359c899 100644
--- a/tests/unit/v1/testdata/set-st-merge-both.json
+++ b/tests/unit/v1/testdata/set-st-merge-both.json
@@ -36,18 +36,13 @@
                 "fieldPaths": [
                   "a"
                 ]
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-merge-nonleaf-alone.json b/tests/unit/v1/testdata/set-st-merge-nonleaf-alone.json
index 4193b00..5af99ab 100644
--- a/tests/unit/v1/testdata/set-st-merge-nonleaf-alone.json
+++ b/tests/unit/v1/testdata/set-st-merge-nonleaf-alone.json
@@ -26,18 +26,13 @@
                 "fieldPaths": [
                   "h"
                 ]
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "h.g",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "h.g",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-merge-nonleaf.json b/tests/unit/v1/testdata/set-st-merge-nonleaf.json
index 5e91d66..e66ca87 100644
--- a/tests/unit/v1/testdata/set-st-merge-nonleaf.json
+++ b/tests/unit/v1/testdata/set-st-merge-nonleaf.json
@@ -37,18 +37,13 @@
                 "fieldPaths": [
                   "h"
                 ]
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "h.g",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "h.g",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-merge-nowrite.json b/tests/unit/v1/testdata/set-st-merge-nowrite.json
index 08fa8b5..44091b1 100644
--- a/tests/unit/v1/testdata/set-st-merge-nowrite.json
+++ b/tests/unit/v1/testdata/set-st-merge-nowrite.json
@@ -19,15 +19,19 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-mergeall.json b/tests/unit/v1/testdata/set-st-mergeall.json
index 26883c0..f913d69 100644
--- a/tests/unit/v1/testdata/set-st-mergeall.json
+++ b/tests/unit/v1/testdata/set-st-mergeall.json
@@ -25,18 +25,13 @@
                 "fieldPaths": [
                   "a"
                 ]
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-multi.json b/tests/unit/v1/testdata/set-st-multi.json
index 23c06f4..0320072 100644
--- a/tests/unit/v1/testdata/set-st-multi.json
+++ b/tests/unit/v1/testdata/set-st-multi.json
@@ -17,22 +17,17 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                },
+                {
+                  "fieldPath": "c.d",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-nested.json b/tests/unit/v1/testdata/set-st-nested.json
index 5c94c33..58406e8 100644
--- a/tests/unit/v1/testdata/set-st-nested.json
+++ b/tests/unit/v1/testdata/set-st-nested.json
@@ -17,18 +17,13 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st-with-empty-map.json b/tests/unit/v1/testdata/set-st-with-empty-map.json
index 063c94a..a407866 100644
--- a/tests/unit/v1/testdata/set-st-with-empty-map.json
+++ b/tests/unit/v1/testdata/set-st-with-empty-map.json
@@ -25,18 +25,13 @@
                     }
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/set-st.json b/tests/unit/v1/testdata/set-st.json
index 42f2b14..3e55ae1 100644
--- a/tests/unit/v1/testdata/set-st.json
+++ b/tests/unit/v1/testdata/set-st.json
@@ -17,18 +17,13 @@
                     "integerValue": "1"
                   }
                 }
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-all-transforms.json b/tests/unit/v1/testdata/update-all-transforms.json
index 6f6a725..72b16d3 100644
--- a/tests/unit/v1/testdata/update-all-transforms.json
+++ b/tests/unit/v1/testdata/update-all-transforms.json
@@ -25,50 +25,45 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  },
-                  {
-                    "fieldPath": "c",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "d",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                },
+                {
+                  "fieldPath": "c",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "d",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-arrayremove-alone.json b/tests/unit/v1/testdata/update-arrayremove-alone.json
index 86fc880..93b8ff0 100644
--- a/tests/unit/v1/testdata/update-arrayremove-alone.json
+++ b/tests/unit/v1/testdata/update-arrayremove-alone.json
@@ -10,31 +10,35 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  }
-                ]
-              },
               "currentDocument": {
                 "exists": true
-              }
-            }
+              },
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
+                  }
+                }
+              ]
+            }  
           ]
         }
       }
diff --git a/tests/unit/v1/testdata/update-arrayremove-multi.json b/tests/unit/v1/testdata/update-arrayremove-multi.json
index df880f6..18ed0fd 100644
--- a/tests/unit/v1/testdata/update-arrayremove-multi.json
+++ b/tests/unit/v1/testdata/update-arrayremove-multi.json
@@ -26,46 +26,41 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "c.d",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-arrayremove-nested.json b/tests/unit/v1/testdata/update-arrayremove-nested.json
index 28d59af..7159797 100644
--- a/tests/unit/v1/testdata/update-arrayremove-nested.json
+++ b/tests/unit/v1/testdata/update-arrayremove-nested.json
@@ -26,30 +26,25 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-arrayremove.json b/tests/unit/v1/testdata/update-arrayremove.json
index d925704..2311f91 100644
--- a/tests/unit/v1/testdata/update-arrayremove.json
+++ b/tests/unit/v1/testdata/update-arrayremove.json
@@ -25,30 +25,25 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-arrayunion-alone.json b/tests/unit/v1/testdata/update-arrayunion-alone.json
index 757ea48..5cb0857 100644
--- a/tests/unit/v1/testdata/update-arrayunion-alone.json
+++ b/tests/unit/v1/testdata/update-arrayunion-alone.json
@@ -10,30 +10,34 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  }
-                ]
-              },
               "currentDocument": {
                 "exists": true
-              }
+              },
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
+                  },
+                  "fieldPath": "a"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-arrayunion-multi.json b/tests/unit/v1/testdata/update-arrayunion-multi.json
index 3aafcd0..674ce2b 100644
--- a/tests/unit/v1/testdata/update-arrayunion-multi.json
+++ b/tests/unit/v1/testdata/update-arrayunion-multi.json
@@ -26,46 +26,41 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "c.d",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-arrayunion-nested.json b/tests/unit/v1/testdata/update-arrayunion-nested.json
index f2bf377..841ceed 100644
--- a/tests/unit/v1/testdata/update-arrayunion-nested.json
+++ b/tests/unit/v1/testdata/update-arrayunion-nested.json
@@ -26,30 +26,25 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-arrayunion.json b/tests/unit/v1/testdata/update-arrayunion.json
index 60192c9..0aca235 100644
--- a/tests/unit/v1/testdata/update-arrayunion.json
+++ b/tests/unit/v1/testdata/update-arrayunion.json
@@ -25,30 +25,25 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-nested-transform-and-nested-value.json b/tests/unit/v1/testdata/update-nested-transform-and-nested-value.json
index ff7bfc6..2ccba09 100644
--- a/tests/unit/v1/testdata/update-nested-transform-and-nested-value.json
+++ b/tests/unit/v1/testdata/update-nested-transform-and-nested-value.json
@@ -31,18 +31,13 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-all-transforms.json b/tests/unit/v1/testdata/update-paths-all-transforms.json
index 01a4c11..40adbca 100644
--- a/tests/unit/v1/testdata/update-paths-all-transforms.json
+++ b/tests/unit/v1/testdata/update-paths-all-transforms.json
@@ -52,50 +52,45 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  },
-                  {
-                    "fieldPath": "c",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "d",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                },
+                {
+                  "fieldPath": "c",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "d",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-arrayremove-alone.json b/tests/unit/v1/testdata/update-paths-arrayremove-alone.json
index 9bc8a14..4097f58 100644
--- a/tests/unit/v1/testdata/update-paths-arrayremove-alone.json
+++ b/tests/unit/v1/testdata/update-paths-arrayremove-alone.json
@@ -19,30 +19,34 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  }
-                ]
-              },
               "currentDocument": {
                 "exists": true
-              }
+              },
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-arrayremove-multi.json b/tests/unit/v1/testdata/update-paths-arrayremove-multi.json
index 9a85471..5e76d07 100644
--- a/tests/unit/v1/testdata/update-paths-arrayremove-multi.json
+++ b/tests/unit/v1/testdata/update-paths-arrayremove-multi.json
@@ -47,46 +47,41 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "c.d",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-arrayremove-nested.json b/tests/unit/v1/testdata/update-paths-arrayremove-nested.json
index e7f952e..9ee1b2a 100644
--- a/tests/unit/v1/testdata/update-paths-arrayremove-nested.json
+++ b/tests/unit/v1/testdata/update-paths-arrayremove-nested.json
@@ -41,30 +41,25 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-arrayremove.json b/tests/unit/v1/testdata/update-paths-arrayremove.json
index 673a2ca..a7be888 100644
--- a/tests/unit/v1/testdata/update-paths-arrayremove.json
+++ b/tests/unit/v1/testdata/update-paths-arrayremove.json
@@ -40,30 +40,25 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "removeAllFromArray": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "removeAllFromArray": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-arrayunion-alone.json b/tests/unit/v1/testdata/update-paths-arrayunion-alone.json
index 81e1e97..2375d0c 100644
--- a/tests/unit/v1/testdata/update-paths-arrayunion-alone.json
+++ b/tests/unit/v1/testdata/update-paths-arrayunion-alone.json
@@ -19,30 +19,34 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  }
-                ]
-              },
               "currentDocument": {
                 "exists": true
-              }
+              },
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
+                  },
+                  "fieldPath": "a"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-arrayunion-multi.json b/tests/unit/v1/testdata/update-paths-arrayunion-multi.json
index ef421bd..afb6437 100644
--- a/tests/unit/v1/testdata/update-paths-arrayunion-multi.json
+++ b/tests/unit/v1/testdata/update-paths-arrayunion-multi.json
@@ -47,46 +47,41 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "4"
-                        },
-                        {
-                          "integerValue": "5"
-                        },
-                        {
-                          "integerValue": "6"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                },
+                {
+                  "fieldPath": "c.d",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "4"
+                      },
+                      {
+                        "integerValue": "5"
+                      },
+                      {
+                        "integerValue": "6"
+                      }
+                    ]
+                  }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-arrayunion-nested.json b/tests/unit/v1/testdata/update-paths-arrayunion-nested.json
index 2d73527..d908d02 100644
--- a/tests/unit/v1/testdata/update-paths-arrayunion-nested.json
+++ b/tests/unit/v1/testdata/update-paths-arrayunion-nested.json
@@ -41,30 +41,25 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-arrayunion.json b/tests/unit/v1/testdata/update-paths-arrayunion.json
index 1401993..ed2966a 100644
--- a/tests/unit/v1/testdata/update-paths-arrayunion.json
+++ b/tests/unit/v1/testdata/update-paths-arrayunion.json
@@ -40,30 +40,25 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "appendMissingElements": {
-                      "values": [
-                        {
-                          "integerValue": "1"
-                        },
-                        {
-                          "integerValue": "2"
-                        },
-                        {
-                          "integerValue": "3"
-                        }
-                      ]
-                    }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "appendMissingElements": {
+                    "values": [
+                      {
+                        "integerValue": "1"
+                      },
+                      {
+                        "integerValue": "2"
+                      },
+                      {
+                        "integerValue": "3"
+                      }
+                    ]
                   }
-                ]
-              }
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-nested-transform-and-nested-value.json b/tests/unit/v1/testdata/update-paths-nested-transform-and-nested-value.json
index 927d783..c4dead0 100644
--- a/tests/unit/v1/testdata/update-paths-nested-transform-and-nested-value.json
+++ b/tests/unit/v1/testdata/update-paths-nested-transform-and-nested-value.json
@@ -48,18 +48,13 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-st-alone.json b/tests/unit/v1/testdata/update-paths-st-alone.json
index 085d049..668c1c9 100644
--- a/tests/unit/v1/testdata/update-paths-st-alone.json
+++ b/tests/unit/v1/testdata/update-paths-st-alone.json
@@ -19,18 +19,22 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              },
               "currentDocument": {
                 "exists": true
-              }
+              },
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-st-multi.json b/tests/unit/v1/testdata/update-paths-st-multi.json
index 2d81380..8767cf3 100644
--- a/tests/unit/v1/testdata/update-paths-st-multi.json
+++ b/tests/unit/v1/testdata/update-paths-st-multi.json
@@ -47,22 +47,17 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                },
+                {
+                  "fieldPath": "c.d",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-st-nested.json b/tests/unit/v1/testdata/update-paths-st-nested.json
index 8bd35c9..94ecacc 100644
--- a/tests/unit/v1/testdata/update-paths-st-nested.json
+++ b/tests/unit/v1/testdata/update-paths-st-nested.json
@@ -41,18 +41,13 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-st-with-empty-map.json b/tests/unit/v1/testdata/update-paths-st-with-empty-map.json
index ac60b27..a86ae46 100644
--- a/tests/unit/v1/testdata/update-paths-st-with-empty-map.json
+++ b/tests/unit/v1/testdata/update-paths-st-with-empty-map.json
@@ -40,20 +40,15 @@
                   "a"
                 ]
               },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ],
               "currentDocument": {
                 "exists": true
               }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-paths-st.json b/tests/unit/v1/testdata/update-paths-st.json
index 011405b..1710508 100644
--- a/tests/unit/v1/testdata/update-paths-st.json
+++ b/tests/unit/v1/testdata/update-paths-st.json
@@ -40,18 +40,13 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-st-alone.json b/tests/unit/v1/testdata/update-st-alone.json
index 1a333f3..49fab17 100644
--- a/tests/unit/v1/testdata/update-st-alone.json
+++ b/tests/unit/v1/testdata/update-st-alone.json
@@ -10,18 +10,22 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              },
               "currentDocument": {
                 "exists": true
-              }
+              },
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-st-dot.json b/tests/unit/v1/testdata/update-st-dot.json
index 83422ca..8b9a769 100644
--- a/tests/unit/v1/testdata/update-st-dot.json
+++ b/tests/unit/v1/testdata/update-st-dot.json
@@ -10,18 +10,22 @@
           "database": "projects/projectID/databases/(default)",
           "writes": [
             {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a.b.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              },
               "currentDocument": {
                 "exists": true
-              }
+              },
+              "update": {
+                "fields": {},
+                "name": "projects/projectID/databases/(default)/documents/C/d"
+              },
+              "updateMask": {
+                "fieldPaths": []
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a.b.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-st-multi.json b/tests/unit/v1/testdata/update-st-multi.json
index 8105ec2..f474112 100644
--- a/tests/unit/v1/testdata/update-st-multi.json
+++ b/tests/unit/v1/testdata/update-st-multi.json
@@ -26,22 +26,17 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  },
-                  {
-                    "fieldPath": "c.d",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                },
+                {
+                  "fieldPath": "c.d",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-st-nested.json b/tests/unit/v1/testdata/update-st-nested.json
index 5a8e732..fa9f46b 100644
--- a/tests/unit/v1/testdata/update-st-nested.json
+++ b/tests/unit/v1/testdata/update-st-nested.json
@@ -26,18 +26,13 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-st-with-empty-map.json b/tests/unit/v1/testdata/update-st-with-empty-map.json
index abeceb0..4a2c27d 100644
--- a/tests/unit/v1/testdata/update-st-with-empty-map.json
+++ b/tests/unit/v1/testdata/update-st-with-empty-map.json
@@ -33,18 +33,13 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "a.c",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "a.c",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }
diff --git a/tests/unit/v1/testdata/update-st.json b/tests/unit/v1/testdata/update-st.json
index 6249d8b..71d17f3 100644
--- a/tests/unit/v1/testdata/update-st.json
+++ b/tests/unit/v1/testdata/update-st.json
@@ -25,18 +25,13 @@
               },
               "currentDocument": {
                 "exists": true
-              }
-            },
-            {
-              "transform": {
-                "document": "projects/projectID/databases/(default)/documents/C/d",
-                "fieldTransforms": [
-                  {
-                    "fieldPath": "b",
-                    "setToServerValue": "REQUEST_TIME"
-                  }
-                ]
-              }
+              },
+              "updateTransforms": [
+                {
+                  "fieldPath": "b",
+                  "setToServerValue": "REQUEST_TIME"
+                }
+              ]
             }
           ]
         }