Skip to content
Discussion options

You must be logged in to vote

Not directly. jsonschema validates a Python object that is already in memory (validate() / iter_errors() take a decoded instance), and some keywords need the whole value at once anyway: uniqueItems, contains/minContains, maxItems, required on a big object, if/then, unevaluated*, and so on. A true streaming validator would need a different, event-driven design.

The common case is a huge array of records, and you can handle that by streaming the records with ijson and validating each one against the items subschema. If that subschema uses $ref, use evolve() on a validator built from the full schema so the refs still resolve against the root:

import ijson
from jsonschema import Draft202012Va…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@anton-daneyko-ultramarin
Comment options

Answer selected by anton-daneyko-ultramarin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants