MCPcopy Index your code
hub / github.com/python-jsonschema/jsonschema / iter_errors

Method iter_errors

jsonschema/validators.py:349–394  ·  view source on GitHub ↗
(self, instance, _schema=None)

Source from the content-addressed store, hash-verified

347 return NewValidator(**changes)
348
349 def iter_errors(self, instance, _schema=None):
350 if _schema is not None:
351 warnings.warn(
352 (
353 "Passing a schema to Validator.iter_errors "
354 "is deprecated and will be removed in a future "
355 "release. Call validator.evolve(schema=new_schema)."
356 "iter_errors(...) instead."
357 ),
358 DeprecationWarning,
359 stacklevel=2,
360 )
361 validators = [
362 (self.VALIDATORS[k], k, v)
363 for k, v in applicable_validators(_schema)
364 if k in self.VALIDATORS
365 ]
366 else:
367 _schema, validators = self.schema, self._validators
368
369 if _schema is True:
370 return
371 elif _schema is False:
372 yield exceptions.ValidationError(
373 f"False schema does not allow {instance!r}",
374 validator=None,
375 validator_value=None,
376 instance=instance,
377 schema=_schema,
378 )
379 return
380
381 for validator, k, v in validators:
382 errors = validator(self, v, instance, _schema) or ()
383 for error in errors:
384 # set details if not already set by the called fn
385 error._set(
386 validator=k,
387 validator_value=v,
388 instance=instance,
389 schema=_schema,
390 type_checker=self.TYPE_CHECKER,
391 )
392 if k not in {"if", "$ref"}:
393 error.schema_path.appendleft(k)
394 yield error
395
396 def descend(
397 self,

Callers 4

check_schemaMethod · 0.95
validateMethod · 0.95
is_validMethod · 0.95
validateFunction · 0.45

Calls 1

_setMethod · 0.80

Tested by

no test coverage detected