valgebra-jsonschema¶
JSON Schema read into valgebra's sets.
A schema answers two questions: whether a value belongs, as the specification states it, and
whether everything one schema admits another admits too. compile_schema reads draft 2020-12,
and drafts 2019-09, 07, 06 and 04 through upgrade, into
valgebra's sets over the values json.loads returns,
and raises Unsupported naming a keyword it does not read; valgebra then decides membership and
inclusion.
from valgebra_jsonschema import compile_schema
tags = compile_schema({"type": "array", "items": {"type": "string", "minLength": 1}})
assert tags.is_valid(["io", "net"])
assert not tags.is_valid(["io", ""])
# Every array of nonempty strings is an array of strings, and not the converse.
strings = compile_schema({"type": "array", "items": {"type": "string"}})
assert tags.relation_to(strings) == "subset"
assert strings.relation_to(tags) == "not_subset"
Membership has the specification's verdict for every keyword the compiler accepts. An
inclusion is subset, not_subset or undecided, and undecided, where valgebra cannot tell,
is never read as either. How it works follows a schema from its document to
both answers, with a diagram for each step.
Start with reading an MCP tool or the recipes; how each keyword compiles is what a schema means here.
The site serves llms.txt, a
manifest of its pages, and
llms-full.txt, their full
text, for a reader that is not a browser. The developer pages under docs/dev/ are not
published:
how a version reaches PyPI, and
the standard for every text. The study files each tool's --check reruns are under
docs/studies/.