A team has connected the underwriting agent to the underwriter cockpit. The agent writes a recommendation for each submission, and the workflow checks one thing before passing it on: did the model return JSON? Over one week of test runs, four outputs come back that deserve a closer look. Each is one of this site's own cases (UW-S..), a scripted output built on the facts of a case the whole series shares (UW-0..).
| Case | Facts of | What the agent wrote | Did it return JSON? |
|---|---|---|---|
UW-S03 | UW-004, roof 9 or 22 years | The recommendation, cut off in the middle of the second reason | no |
UW-S04 | UW-004 | "recommendation": "approved" | yes |
UW-S08 | UW-003, roof age unknown | request_info with an empty missing list | yes |
UW-S10 | UW-002, roof 8 years, zone A | decline, citing R-ROOF-01 | yes |
The check stops one of the four. The other three go to the cockpit. One carries a word the cockpit has no queue for. One asks the broker for more information without saying which. And one recommends declining a sound warehouse because of a rule for roofs older than 25 years in wind zone C. The model recommends; a person decides, and here the person would be asked to decide on a false premise.
All four are wrong. They are wrong in four different ways, and each way needs a different check, with different information, owned by a different part of the system. This page names the four.
Layer 1, syntax: does the text parse?#
The model writes characters. Before any program can look at a field, the characters have to be turned into a value: an object with keys and values. That step is called parsing. A parser reads {"roof_age_years": 9} and returns an object with one key; it reads {"roof_age_years": 9 and stops with an error, because the closing bracket never comes.
The rules a text must follow to be JSON at all (brackets, quotes, commas, the allowed number forms) are its syntax. Text that follows them is well-formed. Syntax is the first layer, and the only question it answers is: is this JSON?
UW-S03 fails here. The model reached its output limit in the middle of a sentence, and the text stops after "more than the 5 years rule". There is no object to look at, so no later check can run.
The example parses with its own small parser, strictjson.py, and not with Python's built-in json module. The reason is that "it parses" depends on the parser. RFC 8259, the standard that defines JSON, says that numeric values such as Infinity and NaN "are not permitted", that names within an object "SHOULD be unique" (software that receives duplicates behaves unpredictably), and that a parser "MAY accept non-JSON forms or extensions". Python's documentation says its json module does exactly that: by default it accepts NaN and Infinity, and with repeated names it keeps the last value without an error.
This short script runs both parsers on two texts a model could write. It shows that a lenient parser turns non-JSON into a value without a word. It was run in a copy of examples/uw-contracts/ with Python 3.14.
import json, strictjson
for text in ['{"stated_confidence": NaN}', '{"recommendation": "decline", "recommendation": "approve"}']:
print("json.loads ", json.loads(text))
try:
print("strictjson.loads", strictjson.loads(text))
except strictjson.ParseError as e:
print("strictjson.loads ParseError:", e)
json.loads {'stated_confidence': nan}
strictjson.loads ParseError: unexpected character 'N' at position 22
json.loads {'recommendation': 'approve'}
strictjson.loads ParseError: duplicate key "recommendation" at position 30
The second line pair is the one to remember. The text says decline and then approve. The lenient parser keeps approve and reports nothing, so every later check sees a clean approve. A strict parser makes the contradiction visible at the first layer, where it belongs.
Common confusion. "Well-formed" and "valid" are different words. Well-formed means the text is JSON. Valid always needs a layer: schema-valid, or valid against the rules. On this site the bare word "valid" is not used.
Layer 2, schema: does the value have the agreed shape?#
UW-S04 parses. It is a perfectly good JSON object. Its first field is "recommendation": "approved", and the contract allows four words: approve, decline, request_info, escalate. "approved" is a well-formed string and not one of them.
The agreed shape is written down in a schema: a machine-readable description of which fields a record has, which type each one holds, and which values are allowed. A fixed list of allowed values is called an enum. This is the part of the recommendation schema that UW-S04 breaks, copied from schemas/recommendation.v1.json:
{"recommendation": {"type": "string", "enum": ["approve", "decline", "request_info", "escalate"], "description": "What the agent recommends to the underwriter. A recommendation, never a decision."}}
A value that passes every rule of its schema is schema-valid. The question of this layer is: are the boxes filled with the right kinds of thing? The example's runner shows the check at work. The model here is a scripted stand-in, so these results show how the mechanism works, not how good any model is.
python3 run_contracts.py --case UW-S04
The model here is a scripted stand-in: these results show how the mechanism works, not how good any model is.
case boundary first failure outcome attempts
UW-S04 final schema accepted_after_reask 2
attempt 1: first failure schema, action re_ask
[schema] /recommendation enum: "approved" is not one of "approve", "decline", "request_info", "escalate"
attempt 2: first failure -, action accept
The error names the field (/recommendation, a pointer to the place in the object), the rule that failed (enum) and the allowed words. That is enough for the workflow to send it back to the model, and the second attempt passes. How a re-ask works is the subject of Repair.
The schema language the example uses is JSON Schema. Its own documentation describes it as "a declarative language for defining structure and constraints for JSON data", and its validation specification says that validation "asserts constraints on the structure of instance data". Structure is the key word. A schema can say that stated_confidence is a number between 0 and 1. It cannot say that 0.62 is honest. JSON Schema teaches the keywords.
Layer 3, semantics: does the record agree with itself?#
UW-S08 passes the schema. Every field has the right type, the recommendation is one of the four words, nothing is missing and nothing is extra. Here it is:
{"recommendation": "request_info", "reasons": ["Neither the application nor the roof-data provider gives a roof age, so rule R-ROOF-02 asks for it."], "citations": ["R-ROOF-02"], "missing": [], "stated_confidence": 0.7, "requires_human": true, "policy_version": "2026.2"}
Read two fields together. request_info means "I need more information before anyone can decide". missing: [] means "I need nothing". Each field is fine on its own; together they contradict each other. The cockpit would send the broker a request for information that names no information.
The third layer is semantics: the record agrees with itself, and its values mean what the contract says they mean. The question is no longer "is each box filled correctly?" but "do the boxes make sense together, and in the agreed units?".
Part of this layer can be checked by code that looks at the record alone. These are the example's cross-field checks for a recommendation, quoted from validate.py, function cross_field_recommendation:
def cross_field_recommendation(v: dict[str, Any]) -> list[dict[str, str]]:
"""Layer 3, the part code can check: the record must agree with itself."""
out = []
rec = v["recommendation"]
if rec == "request_info" and not v["missing"]:
out.append(_e("cross_field", "/missing", "X-MISSING-EMPTY", "request_info must name at least one missing field"))
if rec in ("decline", "escalate") and not v["citations"]:
out.append(_e("cross_field", "/citations", "X-CITATIONS-EMPTY", f"{rec} must cite at least one rule"))
if rec == "approve" and v["missing"]:
out.append(_e("cross_field", "/missing", "X-APPROVE-MISSING", "approve cannot list missing fields"))
seen: set[str] = set()
for i, c in enumerate(v["citations"]):
if c in seen:
out.append(_e("cross_field", f"/citations/{i}", "X-DUPLICATE", f"{strictjson.fmt(c)} is cited twice"))
seen.add(c)
return out
Each check compares fields of one record and needs nothing else: no policy, no evidence, no database. That is what makes it cheap and certain.
Semantics is wider than these checks. Two problems from intake belong to the same layer and cannot be caught by looking at one record:
- Null versus zero. In
UW-S17the email says nothing about the roof, and the intake agent writesroof_age_years: 0. Zero is a brand-new roof. The honest value isnull, which means "nobody said". Both are schema-valid; they mean opposite things. - Units. In
UW-S18the email gives the floor area in square metres, and the intake agent writes 1858 underarea_sq_ft. The integer is fine; its meaning is wrong by a factor of about ten.
The example catches both by asking where each value came from: every value read from the email must point at the words it was read from. A zero with no quote behind it fails; a quote that says "square metres" under a square-foot field fails. Those checks need the email, so the code runs them later, together with the rule checks. The layer is a question about meaning; the code stage that answers it is wherever the needed information is available. Contracts showed the unit case end to end; Schema design is the home of recording a source for every value.
Layer 4, business validity: is it true here?#
UW-S10 passes all three layers so far. It parses, it has the agreed shape, and it agrees with itself: a decline that cites a rule.
{"recommendation": "decline", "reasons": ["The roof is too old for wind zone rules under R-ROOF-01."], "citations": ["R-ROOF-01"], "missing": [], "stated_confidence": 0.66, "requires_human": true, "policy_version": "2026.2"}
The facts are those of UW-002: a sprinklered masonry warehouse in wind zone A, roof 8 years old, and the roof-data provider agrees. Rule R-ROOF-01 of the policy fixture (version 2026.2) applies to roofs older than 25 years in wind zone C. This roof is 8 years old and the zone is A. The rule does not apply. The recommendation is false.
The fourth layer is business validity: the record is true against the rules of the business, the evidence gathered in this run, and who may decide. No schema can see this, because the information is not in the record. It is in the policy fixture, in the tool results of this run, and in the rule that a person decides. A schema checks shape, not truth.
The example checks this layer in validate.py, function domain_recommendation. Each if compares the output with something outside it: the policy version this run read, the rules that exist, the human-decision rule, the deterministic rule check on the facts, the evidence this run gathered.
def domain_recommendation(v: dict[str, Any], ctx: dict[str, Any]) -> list[dict[str, str]]:
"""Layer 4: true against the policy fixture and the evidence gathered in this run."""
out = []
version = ctx["policy_version"]
rules = ctx["rules"]
if v["policy_version"] != version:
out.append(_e("domain", "/policy_version", "D-POLICY-VERSION",
f"this run read policy {version}; the output says {v['policy_version']}"))
for i, c in enumerate(v["citations"]):
if c not in rules:
out.append(_e("domain", f"/citations/{i}", "D-RULE-UNKNOWN", f"{c} is not a rule of policy {version}"))
if v["requires_human"] is not True:
out.append(_e("domain", "/requires_human", "R-HUMAN-01", "every recommendation needs a decision by an underwriter"))
check = eligibility(ctx["facts"], rules)
if v["recommendation"] != check["outcome"] and v["recommendation"] != "escalate":
because = ", ".join(check["rules"]) or "no rule triggered"
out.append(_e("domain", "/recommendation", "D-RULE-RESULT",
f"the rule check gives {check['outcome']} ({because}); the output says {v['recommendation']}"))
for i, c in enumerate(v["citations"]):
if c in rules and c != "R-HUMAN-01" and c not in check["rules"]:
out.append(_e("domain", f"/citations/{i}", "D-CITATION-UNSUPPORTED", f"{c} does not apply to these facts"))
for i, ev in enumerate(v.get("evidence_ids", [])):
if ev not in ctx["evidence"]:
out.append(_e("domain", f"/evidence_ids/{i}", "D-EVIDENCE-UNKNOWN", f"{ev} was not gathered in this run"))
return out
Notice the second argument, ctx. Every check before this layer needed only the output and the schema. This one needs the run: which policy version was read, which rules exist in it, the facts of the submission and the roof assessment, and the evidence ids the tools returned. That is why business validity can only be checked by code that knows the run.
One output through all four#
The diagram follows UW-S10 through the four layers. It passes three and fails the fourth, which is the reason the fourth exists.
Diagram: One output through four layers · UW-S10 passes three and fails the fourth
Read left to right. The output parses, has the agreed shape and agrees with itself. Only the fourth layer, which reads the facts of this run and the policy fixture, sees that the cited rule does not apply. Each layer needs more information than the one before it.
- The output
- Recommendation: The agent's output for the facts of UW-002: a sprinklered masonry warehouse with a roof of 8 years in wind zone A.
- 1 · Syntax
- Parses: The text is well-formed JSON: brackets, quotes and commas are all in place.
- 2 · Schema
- Agreed shape: Seven required fields, right types, decline is one of the four words, no extra field.
- 3 · Semantics
- Agrees with itself: A decline that cites a rule, nothing listed as missing: the fields do not contradict each other.
- 4 · Business validity
- True here: The rule check on the facts of this run triggers no rule. The cited rule is for roofs over 25 years in zone C.
Now the four outputs from the opening, each through the real checks. The loop runs the four cases and drops the first two lines (the stand-in notice and a blank line), which are the same every time. A successful run proves that each output is stopped by exactly one layer, and that each later layer catches what the earlier ones let through.
for c in UW-S03 UW-S04 UW-S08 UW-S10; do python3 run_contracts.py --case $c | tail -n +3; done
case boundary first failure outcome attempts
UW-S03 final parse accepted_after_reask 2
attempt 1: first failure parse, action re_ask
[parse] (whole output) parse: unexpected end of input at position 190
attempt 2: first failure -, action accept
case boundary first failure outcome attempts
UW-S04 final schema accepted_after_reask 2
attempt 1: first failure schema, action re_ask
[schema] /recommendation enum: "approved" is not one of "approve", "decline", "request_info", "escalate"
attempt 2: first failure -, action accept
case boundary first failure outcome attempts
UW-S08 final cross_field accepted_after_reask 2
attempt 1: first failure cross_field, action re_ask
[cross_field] /missing X-MISSING-EMPTY: request_info must name at least one missing field
attempt 2: first failure -, action accept
case boundary first failure outcome attempts
UW-S10 final domain accepted_after_reask 2
attempt 1: first failure domain, action re_ask
[domain] /recommendation D-RULE-RESULT: the rule check gives approve (no rule triggered); the output says decline
[domain] /citations/0 D-CITATION-UNSUPPORTED: R-ROOF-01 does not apply to these facts
attempt 2: first failure -, action accept
The first-failure column reads parse, schema, cross_field, domain. Those are the names of the four stages in the code, and they line up with the four layers with one difference, covered at the end of the page. The second attempt of UW-S10 recommends approve with no citation, and the rule check agrees.
The four layers side by side:
| Layer | The question | What it needs to answer | Example that fails here |
|---|---|---|---|
| Syntax | Is this JSON? | The text | UW-S03: cut off at position 190 |
| Schema | Does it have the agreed shape? | The value and the schema | UW-S04: "approved" outside the enum |
| Semantics | Does it agree with itself and mean what the contract says? | The record; for units and null, also the source | UW-S08: request_info that names nothing |
| Business validity | Is it true here? | The policy fixture, the facts and evidence of this run | UW-S10: a rule that does not apply |
Read the third column from top to bottom. Each layer needs more information than the one above it. That is the deepest difference between the layers, and it decides where each check can run.
Diagram: What each layer needs to read · more information at every step
Read left to right. Syntax needs only the text. Schema needs the value and the schema. Semantics needs the whole record, and for units and null versus zero also the source of each value. Business validity needs the policy fixture and the facts and evidence of this run. That is why each layer can only run where its information is.
- Syntax
- The text: Only the characters the model wrote.
- Schema
- Value and schema: The parsed value and the machine-readable description of its shape.
- Semantics
- The whole record: All fields together; for units and null versus zero, also where each value came from.
- Business validity
- Rules and evidence: The policy fixture this run read, the facts of the submission and tool results, and the evidence ids gathered.
Before AI. A relational database already has these layers. The parser of the SQL statement is syntax. Column types are the schema. ACHECKconstraint is a rule over the values of one row, like a cross-field check, and PostgreSQL's documentation adds a warning worth copying: a check constraint is satisfied when its expression is true or null, so aNOT NULLconstraint is needed to keep nulls out. And business rules ("this policy covers this building") live in the service code above the database, because the database does not hold the rules or the evidence. What is new with a model is that every layer receives text written by a component that can write anything.
Why the order matters#
The four checks run in a fixed order, and the example stops at the first layer that fails. That can look like a matter of taste. It is not, because each check assumes that the ones before it passed.
To show what happens otherwise, the next script runs every stage on its own (stop_at_first=False) on two outputs that break the schema. UW-S05 has no policy_version. UW-S06 writes "stated_confidence": "high". It was run in a copy of examples/uw-contracts/.
from model_sim import load_case
from validate import recommendation_ctx, run_stages
for cid in ("UW-S05", "UW-S06"):
case = load_case(cid)
ctx = recommendation_ctx(case["facts"], case["evidence"])
result = run_stages(case["attempts"][0], ctx, stop_at_first=False)
print(cid)
for stage in result["stages"]:
codes = [e["code"] for e in stage["errors"]]
print(f' {stage["stage"]:<12} {stage["status"]:<8} {codes}')
UW-S05
parse pass []
schema fail ['required']
cross_field pass []
domain crashed ['crash']
UW-S06
parse pass []
schema fail ['type']
cross_field pass []
domain pass []
Two failures of two different kinds. On UW-S05 the business check crashes, because it reads a field that is not there. On UW-S06 it passes, because none of its rules looks at the confidence. A business check that runs on a record the schema rejected either breaks or says "fine" about something it never examined. The schema stage is what lets every later stage trust the shape of what it reads.
The explorer lab runs this idea on twelve outputs that all parse, UW-S04 to UW-S15. Switch each stage on or off and see which one catches the output first, and what reaches the underwriter when nothing does.
The same twelve outputs without the lab, with the stage that catches each one when all stages are on:
| Case | The output, in a few words | Caught by | Error code |
|---|---|---|---|
UW-S04 | "recommendation": "approved" | schema | enum |
UW-S05 | policy_version absent | schema | required |
UW-S06 | "stated_confidence": "high" | schema | type |
UW-S07 | an extra field premium_usd | schema | additionalProperties |
UW-S08 | request_info with missing: [] | cross_field | X-MISSING-EMPTY |
UW-S09 | decline with no citation | cross_field | X-CITATIONS-EMPTY |
UW-S10 | decline citing R-ROOF-01 for an 8-year roof | domain | D-RULE-RESULT, D-CITATION-UNSUPPORTED |
UW-S11 | cites R-ROOF-09, which does not exist | domain | D-RULE-UNKNOWN |
UW-S12 | policy_version: "2025.4" copied from a past decision | domain | D-POLICY-VERSION |
UW-S13 | requires_human: false | domain | R-HUMAN-01 |
UW-S14 | evidence_ids names EV-ROOF-9999, never gathered | domain | D-EVIDENCE-UNKNOWN |
UW-S15 | passes every stage; a reason carries markup and an injected instruction | none | none |
The last row is a warning about the limits of all four layers. UW-S15 is true, consistent and in the agreed shape, and one of its reason strings carries an instruction copied from a retrieved passage. A valid string can still be an attack; Security is its home.
Production pitfall. A dashboard tile that says "structured output success: 100%" usually counts parse successes. In the table above, eleven outputs that parse and pass whatever the tile counts are still stopped by a later layer, and one is passed by all four and still needs care. Count failures per layer, and name the layer in every metric.
Test yourself: which layer?#
Six failures, one at a time. Pick the layer that catches each, then read the reason.
The answers, for a reader without the lab:
| The failure | Layer | Why |
|---|---|---|
{"recommendation": "escalate", "reasons": ["Roof ages differ."], (cut off) | syntax | The text stops in the middle: it is not JSON at all. No later check can run. |
{"recommendation": "approved", ...} | schema | "approved" is a well-formed string but not one of the four allowed words. |
"stated_confidence": "high" | schema | The schema says number. A word is the wrong type. |
"recommendation": "request_info", "missing": [] | semantics | Each field has the right shape. Together they contradict each other: asking for information while naming none. |
"recommendation": "decline", "citations": ["R-ROOF-01"] for a roof of 8 years | business validity | Shape and self-consistency are fine. The rule does not apply to these facts (UW-002). |
"policy_version": "2025.4" in a run that read 2026.2 | business validity | A well-formed version string that is false for this run (UW-007's past decision leaked in). |
Layers and stages: two sets of names#
This site uses two sets of names on purpose. The layers are kinds of right: syntax, schema, semantics, business validity. The stages are steps in the code: parse, schema, cross_field, domain. They line up one to one, with one exception: the semantics layer is wider than the cross_field stage. The cross-field stage checks what the record alone can show. Units and null versus zero are questions of meaning too, but they need the source of each value, so the example checks them in the domain stage, next to the rules.
| Layer (a kind of right) | Code stage | Needs | Owner in the example |
|---|---|---|---|
| Syntax | parse | the text | strictjson.loads |
| Schema | schema | the value, the schema | minischema.validate |
| Semantics | cross_field (and source checks in domain) | the record (and the email quotes) | validate.cross_field_recommendation |
| Business validity | domain | the policy fixture, facts and evidence of the run | validate.domain_recommendation |
How the stages run, what each one returns and where each one runs in production is the subject of Validation.
What this is not. These layers decide whether one output may be accepted. Whether the agent's outputs are good across many runs (well argued, grounded, stable from trial to trial) is measured on eval.sammuthu.com. Checks around the agent that go beyond the shape and rules of its output, such as limits on what it may do, belong to guardrails.sammuthu.com.
For a coding agent. The same four layers on a coding agent'schange_report: a report cut off mid-object fails syntax;"risk": "very low"fails the schema (the enum islow,medium,high);"tests_passed": 44with"tests_run": 42contradicts itself; and"risk": "low"on a change to the authentication module may break a rule of the team. CI can check the first three in code. Review lanes for the fourth live on diff-to-deploy.sammuthu.com.
Where semantics ends and business validity beginsA test: what does the check need to read?
The line between layers 3 and 4 is drawn by information, not by importance. A rule belongs to semantics when the record and the contract alone decide it: request_info must name a missing field everywhere, for every customer, under every policy version. A rule belongs to business validity when it needs something that changes outside the record: the policy fixture (which can change from 2025.4 to 2026.2 and move the roof limit from 30 to 25 years), the evidence of this run, or who is authorized.
The test has a practical use. Semantic rules can live in the contract and travel with it: both producer and consumer can run them. Business rules belong to the consumer that owns the context, and must be versioned with it. Putting a business rule into the schema (for example an enum of the rule ids of one policy version) couples the contract to one version of the business, and every policy change becomes a contract change. Evolution shows what that costs.
Lenient readers move failures to later layersParser extensions, format annotations and coercion
Each layer can be run strictly or leniently, and a lenient layer does not remove a failure: it hands it to a later layer in a less recognizable form. A parser that keeps the last duplicate key turns a contradiction (layer 1) into a clean but arbitrary value that layer 4 may or may not catch. A schema validator that treats format as a note rather than a rule lets a malformed date through layer 2; the JSON Schema 2020-12 validation specification says that format is collected as an annotation and that checking it as an assertion is an option that must be disabled by default. A typed model that converts "9" to 9 hides a producer that writes numbers as strings, until the day it writes "nine".
The design this site uses: strict at layers 1 and 2, every leniency explicit and named in the code (repair.py:unwrap removes a code fence or the prose around one JSON object, and only when the result parses on its own; it never adds a character), and every leniency counted, so that a producer that leans on it shows up in the failure records. Typed models compares the defaults of Pydantic and Java on the same payloads.
What layer 4 still cannot seeThe escalate allowance, stated confidence, and the reasons
Look again at one line of domain_recommendation: a recommendation that differs from the rule check fails, unless it is escalate. That is a design decision, not an oversight. Sending a case to a senior underwriter is always allowed, because it only adds a person; the check refuses outputs that would remove one. The cost is that an agent which escalates everything passes layer 4 every time. That pattern is visible only across many runs, which makes it a measurement question for eval.sammuthu.com, not a contract question.
Two more fields pass every layer by construction. stated_confidence is checked for type and range and nothing else: it is what the model says about itself, not a measured probability. And reasons is checked for count and length: whether the sentences are true and well argued is for the underwriter and for graders. A contract should state these limits in its descriptions, so that no consumer reads a passed check as more than it is.
Stop at the first layer, collect inside a layerWhy the example does both
The example stops at the first failing stage, because a later stage reads what an earlier one approved and its errors on a rejected value are noise (or a crash, as UW-S05 showed). Inside one stage it collects every error, so that one re-ask can carry all of them: UW-S10 reports D-RULE-RESULT and D-CITATION-UNSUPPORTED together. The alternative, stopping at the first error inside a stage, costs one round trip to the model per error, and each round trip is a new chance for the model to break something else. Validation is the home of the error record and of this choice.
Checklist#
- Parse with a strict parser that rejects duplicate keys and
NaN, and log a parse failure as a parse failure. - Write a schema for every output a program consumes, and validate against it before any other check runs.
- List the cross-field rules of each contract in words, then give each one a check and an error code.
- Decide for every field what
nulland0mean, and where units come from. - Give the business checks the context of the run: the policy version read, the facts, the evidence ids.
- Name the layer in every metric, log line and test. Never write "valid" alone.
- Write down what no layer checks (stated confidence, the quality of the reasons), so nobody assumes it was.
In one breath#
An output can be wrong in four ways, and each needs its own check: it may not parse, it may parse into the wrong shape, it may have the right shape and contradict itself, and it may be consistent and still false for this run. Each layer needs more information than the one before: the text, then the schema, then the whole record and its sources, then the rules and evidence of the run. Run them in that order, because each check trusts the ones before it. Parseable is not valid. Valid is not correct.
The four outputs from the opening are now stopped at the layer that matches their fault, and each error names its field and its rule. What is still loose is the second layer: so far the schema has been quoted, not explained. JSON Schema shows what JSON itself can and cannot say, and how a schema describes types, enums, null versus absent, unions and closed objects precisely enough for a validator to enforce.