You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- `path`stating a jsonpath or a xpath within the config (e.g. `images.backend.image`, `deployments.name=backend.helm.values.containers[1]`)
67
+
- `path`stating a jsonpath or a xpath within the config (e.g. `images.backend.image`, `deployments.backend.helm.values.containers.name=backend`)
68
68
- `value`stating an arbitrary value used by the operation (e.g. a string, an integer, a boolean, a yaml object)
69
69
70
70
:::warning `op: add` only for arrays
71
-
Using `op: add` only works as expected when `path` points to an array value. Using `op: add` to add properties to an object (e.g. `deployments[*].helm.values`) will **not** work and instead replace all existing properties.
71
+
Using `op: add` only works as expected when `path` points to an array value. Using `op: add` to add properties to an object (e.g. `deployments.*.helm.values`) will **not** work and instead replace all existing properties.
72
72
:::
73
73
74
74
:::tip Array Paths
75
-
When you want to define a `path` that contains an array (e.g. `deployments`), you have several options:
75
+
When you want to define a `path` that contains an array (e.g. `hooks`), you have several options:
76
76
77
-
1. Use the index of the array item you want to patch, e.g. `deployments[0]`, `deployments/0`
78
-
2. Use a property selector matching the array item(s) you want to patch, e.g. `deployments.name=backend`
79
-
3. Use a wildcard selector to match all array item(s), e.g. `deployments.*`,`deployments[*]` or `deployments/*`
80
-
4. Use a comparison selector matching the array item(s) you want to patch, e.g. `deployments[?(@.helm.timeout=='1000s')]`
81
-
5. Use a regular expression selector matching the array item(s) you want to patch, e.g. `deployments[?(@.name=~/^production/)]`
77
+
1. Use the index of the array item you want to patch, e.g. `hooks[0]`, `hooks/0`
78
+
2. Use a property selector matching the array item(s) you want to patch, e.g. `hooks.name=backend`
79
+
3. Use a wildcard selector to match all array item(s), e.g. `hooks.*`,`hooks[*]` or `hooks/*`
80
+
4. Use a comparison selector matching the array item(s) you want to patch, e.g. `hooks[?(@.events=='before:build')]`
81
+
5. Use a regular expression selector matching the array item(s) you want to patch, e.g. `hooks[?(@.name=~/^production/)]`
82
82
83
83
Using a selector rather than the array index is often better because it is more resilient and will not cause any issues even if the order of an array's items is changed later on. A selector is also able to select multiple array items if all of them have the same value for this property.
0 commit comments