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

Method descend

jsonschema/validators.py:396–446  ·  view source on GitHub ↗
(
            self,
            instance,
            schema,
            path=None,
            schema_path=None,
            resolver=None,
        )

Source from the content-addressed store, hash-verified

394 yield error
395
396 def descend(
397 self,
398 instance,
399 schema,
400 path=None,
401 schema_path=None,
402 resolver=None,
403 ):
404 if schema is True:
405 return
406 elif schema is False:
407 yield exceptions.ValidationError(
408 f"False schema does not allow {instance!r}",
409 validator=None,
410 validator_value=None,
411 instance=instance,
412 schema=schema,
413 )
414 return
415
416 if self._ref_resolver is not None:
417 evolved = self.evolve(schema=schema)
418 else:
419 if resolver is None:
420 resolver = self._resolver.in_subresource(
421 specification.create_resource(schema),
422 )
423 evolved = self.evolve(schema=schema, _resolver=resolver)
424
425 for k, v in applicable_validators(schema):
426 validator = evolved.VALIDATORS.get(k)
427 if validator is None:
428 continue
429
430 errors = validator(evolved, v, instance, schema) or ()
431 for error in errors:
432 # set details if not already set by the called fn
433 error._set(
434 validator=k,
435 validator_value=v,
436 instance=instance,
437 schema=schema,
438 type_checker=evolved.TYPE_CHECKER,
439 )
440 if k not in {"if", "$ref"}:
441 error.schema_path.appendleft(k)
442 if path is not None:
443 error.path.appendleft(path)
444 if schema_path is not None:
445 error.schema_path.appendleft(schema_path)
446 yield error
447
448 def validate(self, *args, **kwargs):
449 for error in self.iter_errors(*args, **kwargs):

Callers 15

_validate_referenceMethod · 0.95
patternPropertiesFunction · 0.80
propertyNamesFunction · 0.80
additionalPropertiesFunction · 0.80
itemsFunction · 0.80
dependentSchemasFunction · 0.80
propertiesFunction · 0.80
allOfFunction · 0.80
anyOfFunction · 0.80
oneOfFunction · 0.80
if_Function · 0.80
unevaluatedPropertiesFunction · 0.80

Calls 3

evolveMethod · 0.95
getMethod · 0.80
_setMethod · 0.80

Tested by

no test coverage detected