File: update-paths-nested-transform-and-nested-value.json

package info (click to toggle)
golang-google-cloud 0.56.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, bullseye-backports, sid
  • size: 22,368 kB
  • sloc: sh: 191; ansic: 75; makefile: 65; awk: 64; asm: 46; python: 21
file content (69 lines) | stat: -rw-r--r-- 2,665 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
  "tests": [
    {
      "description": "update-paths: Nested transforms should not affect the field mask, even\nwhen there are other values that do. Transforms should only affect the\nDocumentTransform_FieldTransform list.",
      "comment": "For updates, top-level paths in json-like map inputs\nare split on the dot. That is, an input {\"a.b.c\": 7} results in an update to\nfield c of object b of object a with value 7. In order to specify this behavior,\nthe update must use a fieldmask \"a.b.c\". However, fieldmasks are only used for\nconcrete values - transforms are separately encoded in a\nDocumentTransform_FieldTransform array.\n\nThis test exercises a bug found in python (https://github.com/googleapis/google-cloud-python/issues/7215)\nin which nested transforms ({\"a.c\": \"ServerTimestamp\"}) next to nested values\n({\"a.b\": 7}) incorrectly caused the fieldmask \"a\" to be set, which has the\neffect of wiping out all data in \"a\" other than what was specified in the\njson-like input.\n\nInstead, as this test specifies, transforms should not affect the fieldmask.",
      "updatePaths": {
        "docRefPath": "projects/projectID/databases/(default)/documents/C/d",
        "fieldPaths": [
          {
            "field": [
              "a",
              "b"
            ]
          },
          {
            "field": [
              "a",
              "c"
            ]
          }
        ],
        "jsonValues": [
          "7",
          "\"ServerTimestamp\""
        ],
        "request": {
          "database": "projects/projectID/databases/(default)",
          "writes": [
            {
              "update": {
                "name": "projects/projectID/databases/(default)/documents/C/d",
                "fields": {
                  "a": {
                    "mapValue": {
                      "fields": {
                        "b": {
                          "integerValue": "7"
                        }
                      }
                    }
                  }
                }
              },
              "updateMask": {
                "fieldPaths": [
                  "a.b"
                ]
              },
              "currentDocument": {
                "exists": true
              }
            },
            {
              "transform": {
                "document": "projects/projectID/databases/(default)/documents/C/d",
                "fieldTransforms": [
                  {
                    "fieldPath": "a.c",
                    "setToServerValue": "REQUEST_TIME"
                  }
                ]
              }
            }
          ]
        }
      }
    }
  ]
}