Skip to content

JSON Schema

The JSON Schema is the primary binding for SPEC §§4–7 (JSON Schema Draft 2020-12). Every SPEC.md example and every conformance vector validates against it. It is synced from the canonical repository at build time.

What it validates

The root $ref is a oneOf over the addressable record kinds, discriminated by recordType:

tombstone, Measurement, Program, Session, Block, Exercise, WorkUnit, ThresholdProfile, StatusPeriod

plus the shared $defs for value objects — including Target, scalarOrTarget, TargetWithRamp, scalarOrTargetWithRamp (the load.value/Intensity.value superset that adds the ramp branch), Load, EffortLoad, Intensity, Progression, phasePattern, Descriptors, modifiers, outcome, ExerciseRef, Participant, sides, link, mediaItem, extension, provenance, envelope, prescription, performance, Rep, and the primitives (fixedPoint, number, id, timestamp).

Open registry-backed tokens (§5.9) are typed string; genuinely closed enums are constrained to their value set.

Using it

In the reference implementation, validate(record) runs this schema via ajv plus a semantic pass covering several of the context-dependent rules above (e.g. §5.2 Program phase cross-checks, §5.5 scoring↔metric agreement and the sets/performance mutual exclusion, §5.12 Load.unit conditionality, §7.5 tombstone strictness). See Getting started. Rules the pass does not cover remain the implementer’s responsibility. The canonicalization algorithm is not among them: per SPEC §8.3 an implementation is judged by its inputs and outputs against the published vectors — the test tooling and reference implementation implement the algorithm as the equivalence oracle, and you are not required to.