Yicheng Li

JSON Schema catches the shape. Your compliance bugs live between the fields.

Published September 3, 2026 · Updated September 3, 2026 · Version 1.0.0 · Yicheng Li

Consider this record:

{
  "download_tests_total": 42,
  "download_tests_meeting_threshold": 43
}

Both values are non-negative integers. Both fields are present. Each value can satisfy every constraint written against it in isolation.

The record is still impossible. Forty-three tests cannot pass out of forty-two tests run.

This is the point where a data schema stops being the whole contract. A schema can be correct, a validator can report success, and a downstream decision can still be wrong because the rule lives in the relationship between two fields.

I ran into this boundary while building an open data format for broadband compliance evidence. The domain is specific, but the engineering pattern is not. Financial records, telemetry, health data, inventory, and API payloads all contain invariants that do not belong to one property at a time.

What JSON Schema does well

JSON Schema draft 2020-12 is a strong foundation for a portable data contract. It can declare types, ranges, string patterns, enums, required properties, array structure, and whether unknown fields are allowed. A validator in another language can enforce those rules without adopting your application code.

It can also describe useful relationships. The if, then, and else keywords can select a subschema from the value of a discriminator. In the BEAD compliance toolkit, for example, a BABA record on the domestic-certification path requires a certification reference and manufacturing location, while a waiver record requires a waiver reference, product identifier, product category, and 10-digit HS code.

That is real business logic, and it belongs in the schema.

But standard JSON Schema does not provide a keyword that means “the numeric value of this sibling property must not exceed that sibling property.” It does not subtract two timestamps and check the duration. dependentRequired can say that one property’s presence requires another property’s presence; it cannot compare their values.

That boundary is not a defect in JSON Schema. It is a reason to be precise about what a successful schema validation actually proves.

The expensive rules are often relationships

These are some of the invariants in the toolkit that need an explicit cross-field pass:

Invariant Bad record that individual field checks miss
Observation period ends at or after it starts well-formed timestamps in reverse order
Passing test count does not exceed total tests 43 passing out of 42 total
Packets received do not exceed packets sent two valid non-negative counts that contradict each other
A successful speed test lasts at least 15 seconds two valid timestamps only 10 seconds apart
An installed or active location has an install date a valid status with a conditionally missing fact
BABA evidence follows exactly one compliance path individually valid fields from incompatible paths

The last two can be modeled declaratively with conditional subschemas. The first four require comparing or computing from arbitrary instance values, so each language binding needs code. In either case, the observable behavior should be pinned outside the implementation. Otherwise two validators can both claim to implement the same format while accepting different records.

The passing-count example is especially important. A numerator above its denominator is not a harmless rounding issue. In performance reporting it can be the signature of a filtered denominator: failed observations were excluded from the total while successful ones were retained. The types are fine. The evidence chain is not.

A conformance vector makes the rule executable

The toolkit publishes every important validation example as plain JSON. A shortened version of the count case looks like this:

{
  "conformance_suite_version": "0.1.0",
  "name": "crossfield/download_passing_exceeds_total",
  "schema": "performance",
  "valid": false,
  "instance": {
    "download_tests_total": 42,
    "download_tests_meeting_threshold": 43
  },
  "expect_fields": ["download_tests_meeting_threshold"],
  "rationale": "A passing count above the total is the signature of a filtered denominator."
}

The real vector contains a complete record, but its contract is simple. A conforming implementation must:

  1. accept every case marked valid;
  2. reject every case marked invalid; and
  3. for a rejected case, blame every path listed in expect_fields.

The third rule matters more than it may seem. “This record is invalid” is technically correct and operationally useless when someone has to repair a row with 26 fields. The error needs to point to download_tests_meeting_threshold, not merely to the record that contains it.

The suite makes expect_fields a subset requirement rather than an exact match. A validator may report additional related fields, but it cannot omit the field the submitter needs to fix. This leaves room for good diagnostics without making error prose part of the wire contract.

The first run should fail

The current public suite contains 87 vectors across performance facts, raw tests, funded locations, BABA evidence, provenance, strictness, and cross-field behavior.

Its first run against the Python reference implementation failed three cases. The validation logic already rejected unknown properties, but it blamed the object as a whole instead of naming the unexpected property. Existing unit tests had checked that the property name appeared somewhere in the message; they had not checked the error path a caller would receive.

That distinction sounds small until a CSV import contains a stray column and the user gets told only that row 10,000 is invalid. The conformance suite found a product defect, not just a test defect.

This is why I prefer vectors maintained separately from implementation tests. A unit test tends to inherit the structure and assumptions of the code it exercises. A plain JSON vector describes only the behavior a consumer is entitled to rely on.

A second language is a portability test

The project also includes a separate TypeScript binding built on Ajv. It loads the same published schemas, adds the rules that require value comparisons, and runs the same language-neutral vectors. It passes all 87.

That result does not prove the underlying policy interpretation is perfect. It proves a narrower and valuable claim: the format’s documented validation behavior is not an accident of Python, Pydantic, or one set of exception classes.

Writing a second binding exposes the places where “the schema is normative” is true and the places where it is only an aspiration. If the second implementation needs to copy a hidden branch from the first, the contract is not portable yet. The missing behavior belongs in a published rule and a vector.

A pattern worth copying

For data that will cross teams, companies, or programming languages, I now use five layers:

  1. A normative schema for everything that can be stated declaratively.
  2. A reference binding that adds the comparisons and computations the schema cannot express.
  3. Language-neutral conformance vectors containing valid cases, invalid cases, expected error paths, and a rationale.
  4. A second binding using a different language and validator to demonstrate that the contract travels.
  5. Versioned behavior so an existing case is not silently rewritten when the rule changes.

The rationale field is part of the artifact, not a code comment. If someone disputes a case, they can see what it asserts and which source supports it. If the expected outcome changes, that is a contract change with a version—not an invisible edit to make a test green.

There is still a boundary. A conformance suite can prove that implementations agree on the records they are given. It cannot prove that a provider supplied every observation, that source data is authentic, or that a regulator will reach a binding determination. Those are provenance, process, and governance questions. Good tooling should make that limit visible rather than converting missing evidence into false confidence.

The schemas, all 87 vectors, and both implementations are public in the BEAD compliance toolkit. The most useful entry points are the conformance suite and the TypeScript binding.


Yicheng (Ethan) Li is a software engineer specializing in large-scale distributed systems and manufacturing data infrastructure. He builds open tooling for broadband compliance data. M.Sc. EE, Columbia University.

The BEAD compliance toolkit is an independent open-source project and is not affiliated with, endorsed by, or sponsored by NTIA, the FCC, USAC, or any equipment manufacturer or service provider.