The only target dialect is Draft 2020-12.
Example:
from jsonpath_schema import validateJSONPath
schema = {"properties": {"name": {"type": "string"}}}
assert validateJSONPath("$.name", schema, {}, strict=True)
assert not validateJSONPath("$.unknown", schema, {}, strict=True)
assert validateJSONPath("$.unknown", schema, {}, strict=False)- Strict mode accepts only paths declared by
properties,patternProperties,prefixItems, oritems. - Lax mode also traverses unspecified areas unless a supported structural
keyword closes them. It observes
additionalPropertiesandunevaluatedProperties.
Supported schema features are Boolean schemas, type, properties,
patternProperties, additionalProperties, unevaluatedProperties,
prefixItems, items, maxItems, $ref, allOf, anyOf, and oneOf.
- JSON Schema drafts other than Draft 2020-12, custom dialects, and metaschema validation.
- Full instance validation. Value constraints such as
enum,const,required, numeric or string limits, dependencies, and object-size limits are not evaluated. - General
notprocessing. - Fetching references from the network.
- JSONPath single quotes, wildcards, filters, slices, negative indices, unions, functions, and recursive descent.
Supported JSONPath syntax is $, .name for ASCII identifiers, nonnegative
array indices such as [0], and JSON-quoted property names such as
["arbitrary.name"].
Invalid or unsupported JSONPath expressions and missing references raise
ValueError. Reached unsupported schema constructs raise UnsupportedSchema.
A False result means the path is structurally invalid within the supported
subset.