ARITHMETIC → JSON SCHEMA

A schema that
does the math.

Write an equation. Download its schema.
Exact decimal checks across fields, using your existing validator.

JSON

Use +, - and =. Bounds apply to every field.

Amounts are strings. A single wrong cent should fail.

Validates the decimal-string record exactly as shown above.

Checking…

Preparing the generated schema.

Validated by Ajv

THE OUTPUT

One portable schema file.

Standard Draft 2020-12. No custom keywords or validation hooks.

THIS FILE ACCEPTS—

SCHEMA SIZE—
RECORD SIZE—
DECISION NODES—
DIGIT TESTS / RECORD—
LAST VALIDATION—

Validate this file elsewhere

No Schema Calc, Node or clone needed: Python 3 and jsonschema 4.25.1 (tested on Python 3.13). Put both downloads beside validate.py and run:

Expected output: —

Inspect the actual generated schema JSON ↗
Inspect JSON passed to the validator JSON ↗

How it works

Original JSON uses digit tests and a carry graph. Compact tally JSON uses standard contains counts and a small recursive adder. Neither encoding needs custom validator logic.

Deliberately bounded

The compiler supports sums and differences of nonnegative decimal strings, constants and multiple equalities. No multiplication, comparisons or signed input amounts yet. The compact encoding changes the exported record format.