Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSONPath Schema Reachability

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)

Semantics

  • Strict mode accepts only paths declared by properties, patternProperties, prefixItems, or items.
  • Lax mode also traverses unspecified areas unless a supported structural keyword closes them. It observes additionalProperties and unevaluatedProperties.

Supported schema features are Boolean schemas, type, properties, patternProperties, additionalProperties, unevaluatedProperties, prefixItems, items, maxItems, $ref, allOf, anyOf, and oneOf.

Not Supported

  • 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 not processing.
  • 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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages