Skip to content

Commit 2ff2da9

Browse files
committed
Zero targets, or more than one
1 parent 8e3cbae commit 2ff2da9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

versions/1.1.0-dev.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,21 @@ This object MAY be extended with [Specification Extensions](#specification-exten
107107

108108
#### Action Object
109109

110-
This object represents one or more changes to be applied to the target document at the location defined by the target JSONPath expression.
110+
This object represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression.
111111

112112
##### Fixed Fields
113113

114114
| Field Name | Type | Description |
115115
| ---- | :----: | ---- |
116116
| <a name="action-target"></a>target | `string` | **REQUIRED** A RFC9535 JSONPath query expression selecting nodes in the target document. |
117117
| <a name="action-description"></a>description | `string` | A description of the action. [[CommonMark]] syntax MAY be used for rich text representation. |
118-
| <a name="action-update"></a>update | Any | If the `target` selects an object node, the value of this field MUST be an object with the properties and values to merge with the selected node. If the `target` selects an array, the value of this field MUST be an entry to append to the array. This field has no impact if the `remove` field of this action object is `true` or if the `copy` field contains a value. |
118+
| <a name="action-update"></a>update | Any | If the `target` selects object nodes, the value of this field MUST be an object with the properties and values to merge with each selected object. If the `target` selects array nodes, the value of this field MUST be an entry to append to each selected array. This field has no impact if the `remove` field of this action object is `true` or if the `copy` field contains a value. |
119119
| <a name="action-copy"></a>copy | `string` | A JSONPath expression selecting a single node to copy into the `target` nodes. If the `target` selects an object node, the value of this field MUST be an object with the properties and values to merge with the selected node. If the `target` selects an array, the value of this field MUST be an entry to append to the array. This field has no impact if the `remove` field of this action object is `true` or if the `update` field contains a value. |
120-
| <a name="action-remove"></a>remove | `boolean` | A boolean value that indicates that the target object or array MUST be removed from the the map or array it is contained in. The default value is `false`. |
120+
| <a name="action-remove"></a>remove | `boolean` | A boolean value that indicates that each of the target objects or arrays MUST be removed from the the map or array it is contained in. The default value is `false`. |
121121

122-
The result of the `target` JSONPath expression MUST be zero or more objects or arrays (not primitive types or `null` values). Should the `target` JSONPath result in selecting two or more nodes, they MUST be either all objects or all arrays.
122+
The result of the `target` JSONPath expression MUST be zero or more objects or arrays (not primitive types or `null` values).
123+
If the `target` JSONPath expression selects zero nodes, the action succeeds without changing the target document.
124+
If the `target` JSONPath expression selects two or more nodes for an `update` or `copy` action, the selected nodes MUST be either all objects or all arrays.
123125

124126
To update a primitive property value such as a string, the `target` expression should select the _containing_ object in the target document and `update` should contain an object with the property and its new primitive value.
125127

0 commit comments

Comments
 (0)