@@ -230,6 +230,8 @@ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i
230
230
return ;
231
231
}
232
232
233
+ $ throwExceptions = $ this ->factory ->getConfig (Constraint::CHECK_MODE_EXCEPTIONS );
234
+
233
235
if (isset ($ schema ->allOf )) {
234
236
$ isValid = true ;
235
237
foreach ($ schema ->allOf as $ allOf ) {
@@ -245,13 +247,15 @@ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i
245
247
if (isset ($ schema ->anyOf )) {
246
248
$ isValid = false ;
247
249
$ startErrors = $ this ->getErrors ();
250
+ $ this ->factory ->removeConfig ($ throwExceptions );
248
251
foreach ($ schema ->anyOf as $ anyOf ) {
249
252
$ initErrors = $ this ->getErrors ();
250
253
$ this ->checkUndefined ($ value , $ anyOf , $ path , $ i );
251
254
if ($ isValid = (count ($ this ->getErrors ()) == count ($ initErrors ))) {
252
255
break ;
253
256
}
254
257
}
258
+ $ this ->factory ->addConfig ($ throwExceptions );
255
259
if (!$ isValid ) {
256
260
$ this ->addError (ConstraintError::ANY_OF (), $ path );
257
261
} else {
@@ -263,6 +267,7 @@ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i
263
267
$ allErrors = array ();
264
268
$ matchedSchemas = 0 ;
265
269
$ startErrors = $ this ->getErrors ();
270
+ $ this ->factory ->removeConfig ($ throwExceptions );
266
271
foreach ($ schema ->oneOf as $ oneOf ) {
267
272
$ this ->errors = array ();
268
273
$ this ->checkUndefined ($ value , $ oneOf , $ path , $ i );
@@ -271,6 +276,7 @@ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i
271
276
}
272
277
$ allErrors = array_merge ($ allErrors , array_values ($ this ->getErrors ()));
273
278
}
279
+ $ this ->factory ->addConfig ($ throwExceptions );
274
280
if ($ matchedSchemas !== 1 ) {
275
281
$ this ->addErrors (array_merge ($ allErrors , $ startErrors ));
276
282
$ this ->addError (ConstraintError::ONE_OF (), $ path );
0 commit comments