11[
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+
210 {
311 "comment" : " A.1. Adding an Object Member" ,
412 "doc" : {
1422 },
1523
1624 {
17- "comment" : " A.2. Adding an Array Element" ,
25+ "comment" : " A.2. Adding an Array Element" ,
1826 "doc" : {
1927 "foo" : [ " bar" , " baz" ]
2028},
5866 "doc" : {
5967 "baz" : " qux" ,
6068 "foo" : " bar"
61- },
69+ },
6270 "patch" : [
6371 { "op" : " replace" , "path" : " /baz" , "value" : " boo" }
6472],
7886 "qux" : {
7987 "corge" : " grault"
8088 }
81- },
89+ },
8290 "patch" : [
8391 { "op" : " move" , "from" : " /foo/waldo" , "path" : " /qux/thud" }
84- ],
92+ ],
8593 "expected" : {
8694 "foo" : {
8795 "bar" : " baz"
97105 "comment" : " A.7. Moving an Array Element" ,
98106 "doc" : {
99107 "foo" : [ " all" , " grass" , " cows" , " eat" ]
100- },
108+ },
101109 "patch" : [
102110 { "op" : " move" , "from" : " /foo/1" , "path" : " /foo/3" }
103- ],
111+ ],
104112 "expected" : {
105113 "foo" : [ " all" , " cows" , " eat" , " grass" ]
106114}
131139 "patch" : [
132140 { "op" : " test" , "path" : " /baz" , "value" : " bar" }
133141],
134- "error" : " string not equivalent"
142+ "error" : " string not equivalent"
135143 },
136144
137145 {
150158 }
151159}
152160 },
153-
161+
154162 {
155163 "comment" : " A.11. Ignoring Unrecognized Elements" ,
156164 "doc" : {
157165 "foo" :" bar"
158- },
166+ },
159167 "patch" : [
160168 { "op" : " add" , "path" : " /baz" , "value" : " qux" , "xyz" : 123 }
161169],
162170 "expected" : {
163- "foo" :" bar" ,
171+ "foo" :" bar" ,
164172 "baz" :" qux"
165173}
166174 },
167-
175+
168176 {
169177 "comment" : " A.12. Adding to a Non-existant Target" ,
170178 "doc" : {
175183],
176184 "error" : " add to a non-existant target"
177185 },
178-
186+
179187 {
180188 "comment" : " A.13 Invalid JSON Patch Document" ,
181189 "doc" : {
186194],
187195 "error" : " operation has two 'op' members"
188196 },
189-
190- {
197+
198+ {
191199 "comment" : " A.14. ~ Escape Ordering" ,
192200 "doc" : {
193201 "/" : 9 ,
196204 "patch" : [{"op" : " test" , "path" : " /~01" , "value" : 10 }],
197205 "expected" : {
198206 "/" : 9 ,
199- "~1" : 10
207+ "~1" : 10
200208 }
201209 },
202210
203- {
211+ {
204212 "comment" : " A.15. Comparing Strings and Numbers" ,
205213 "doc" : {
206214 "/" : 9 ,
210218 "error" : " number is not equal to string"
211219 },
212220
213- {
221+ {
214222 "comment" : " A.16. Adding an Array Value" ,
215223 "doc" : {
216224 "foo" : [" bar" ]
217225 },
218226 "patch" : [{ "op" : " add" , "path" : " /foo/-" , "value" : [" abc" , " def" ] }],
219227 "expected" : {
220- "foo" : [" bar" , [" abc" , " def" ]]
228+ "foo" : [" bar" , [" abc" , " def" ]]
221229 }
222230 }
223231
224- ]
232+ ]
0 commit comments