0008. Generated JSON Schemas live where packs are assembled
Status: Accepted · Date: 2026-11-10
Context
ADR-0006 says that the JSON Schema files generated from the Zod schemas are "committed and shipped in @yokla/core". But the profile and case schemas depend on the loaded packs:
- a domain pack adds its profile section and its expectation keys,
- language packs decide which language codes are valid.
core can't import packs (design §6), so it can't produce these schemas.
Decision
- The JSON Schema files are generated in the CLI package,
yokla, which assembles the first-party packs. They live inpackages/cli/schemas/and ship with theyoklanpm package. results.v1is generated in the same place, although it doesn't depend on packs. Every schema file then has one home.- A test compares the generated schemas with the committed files. CI fails when they drift.
pnpm test -uregenerates them. - This ADR replaces only the sentence in ADR-0006 about where the files ship. The rest of ADR-0006 stands.
Consequences
- Editors and other tools take the schemas from the
yoklapackage. - A third-party pack changes the profile schema. A user who loads one gets an accurate schema from the CLI command that prints it, not from the committed files. That command comes with the CLI.
Alternatives considered
- Ship base schemas in
core, with pack sections left open. The schemas would accept any pack section without checking it, so editors couldn't catch typos inside them. Rejected. - Generate the schemas from a repository script. The root package may not depend on workspace packages (layer rule), so the script would bypass the packages' public entry points. Rejected.