1
1
[
2
+ {
3
+ "comment" : " 4.1. add with missing object" ,
4
+ "doc" : { "q" : { "bar" : 2 } },
5
+ "patch" : [ {"op" : " add" , "path" : " /a/b" , "value" : 1 } ],
6
+ "error" :
7
+ " path /a does not exist -- missing objects are not created recursively"
8
+ },
9
+
2
10
{
3
11
"comment" : " A.1. Adding an Object Member" ,
4
12
"doc" : {
14
22
},
15
23
16
24
{
17
- "comment" : " A.2. Adding an Array Element" ,
25
+ "comment" : " A.2. Adding an Array Element" ,
18
26
"doc" : {
19
27
"foo" : [ " bar" , " baz" ]
20
28
},
58
66
"doc" : {
59
67
"baz" : " qux" ,
60
68
"foo" : " bar"
61
- },
69
+ },
62
70
"patch" : [
63
71
{ "op" : " replace" , "path" : " /baz" , "value" : " boo" }
64
72
],
78
86
"qux" : {
79
87
"corge" : " grault"
80
88
}
81
- },
89
+ },
82
90
"patch" : [
83
91
{ "op" : " move" , "from" : " /foo/waldo" , "path" : " /qux/thud" }
84
- ],
92
+ ],
85
93
"expected" : {
86
94
"foo" : {
87
95
"bar" : " baz"
97
105
"comment" : " A.7. Moving an Array Element" ,
98
106
"doc" : {
99
107
"foo" : [ " all" , " grass" , " cows" , " eat" ]
100
- },
108
+ },
101
109
"patch" : [
102
110
{ "op" : " move" , "from" : " /foo/1" , "path" : " /foo/3" }
103
- ],
111
+ ],
104
112
"expected" : {
105
113
"foo" : [ " all" , " cows" , " eat" , " grass" ]
106
114
}
131
139
"patch" : [
132
140
{ "op" : " test" , "path" : " /baz" , "value" : " bar" }
133
141
],
134
- "error" : " string not equivalent"
142
+ "error" : " string not equivalent"
135
143
},
136
144
137
145
{
150
158
}
151
159
}
152
160
},
153
-
161
+
154
162
{
155
163
"comment" : " A.11. Ignoring Unrecognized Elements" ,
156
164
"doc" : {
157
165
"foo" :" bar"
158
- },
166
+ },
159
167
"patch" : [
160
168
{ "op" : " add" , "path" : " /baz" , "value" : " qux" , "xyz" : 123 }
161
169
],
162
170
"expected" : {
163
- "foo" :" bar" ,
171
+ "foo" :" bar" ,
164
172
"baz" :" qux"
165
173
}
166
174
},
167
-
175
+
168
176
{
169
177
"comment" : " A.12. Adding to a Non-existant Target" ,
170
178
"doc" : {
175
183
],
176
184
"error" : " add to a non-existant target"
177
185
},
178
-
186
+
179
187
{
180
188
"comment" : " A.13 Invalid JSON Patch Document" ,
181
189
"doc" : {
186
194
],
187
195
"error" : " operation has two 'op' members"
188
196
},
189
-
190
- {
197
+
198
+ {
191
199
"comment" : " A.14. ~ Escape Ordering" ,
192
200
"doc" : {
193
201
"/" : 9 ,
196
204
"patch" : [{"op" : " test" , "path" : " /~01" , "value" : 10 }],
197
205
"expected" : {
198
206
"/" : 9 ,
199
- "~1" : 10
207
+ "~1" : 10
200
208
}
201
209
},
202
210
203
- {
211
+ {
204
212
"comment" : " A.15. Comparing Strings and Numbers" ,
205
213
"doc" : {
206
214
"/" : 9 ,
210
218
"error" : " number is not equal to string"
211
219
},
212
220
213
- {
221
+ {
214
222
"comment" : " A.16. Adding an Array Value" ,
215
223
"doc" : {
216
224
"foo" : [" bar" ]
217
225
},
218
226
"patch" : [{ "op" : " add" , "path" : " /foo/-" , "value" : [" abc" , " def" ] }],
219
227
"expected" : {
220
- "foo" : [" bar" , [" abc" , " def" ]]
228
+ "foo" : [" bar" , [" abc" , " def" ]]
221
229
}
222
230
}
223
231
224
- ]
232
+ ]
0 commit comments