Repository navigation
Adds ADR-0002, the document's JSON Schema - #35
Merged
Merged
Conversation
Proposes ADR-0002: the datamodel document ships a hand-written draft-07 JSON Schema at priv/schemas/datamodel-document.schema.json, read through StatifierDatamodel.Schema.path/0 and json/0. The schema is advisory, never the admission rule: index/1 stays the total normalizer, nothing in the package calls the schema, and a document the schema rejects indexes exactly as today. Every object stays open to unknown keys, the $id is keyed on the document version, and a version bump ships a second file. ex_json_schema is named as the test-only validator, and a drift test is named that pins the nine closed type spellings the schema lists to the index. ADR-0001 gains a dated Note at its foot pointing at the new record; no decision and no status line of ADR-0001 changes. The ADR index gains one row. Documentation only: no code, and no changelog fragment (changelog.d/README.md excludes ADRs). Refs: sd-kjj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Proposes ADR-0002: the datamodel document ships a JSON Schema - draft-07, hand-written, advisory, never the admission rule. The record merges at proposed; its acceptance is the operator's.
docs/adr/0002-datamodel-document-json-schema.md(new): Context, Decision, the typespecs section, a worked example and Consequences. The Decision names the file (priv/schemas/datamodel-document.schema.json, added to the Hexfiles:list), the reader (StatifierDatamodel.Schema.path/0andjson/0, embedded at compile time), draft-07 withex_json_schema ~> 0.11test-only, hand-written with a drift test on the nine closed type spellings, advisory not admission (index/1stays the total normalizer and nothing in the package calls the schema), open objects, the$idkeyed on the documentversion, and the versioning rule (aversionbump ships a second file).docs/adr/0001-datamodel-document.md: a dated Note appended at the foot pointing at ADR-0002. It changes no decision; the Status line and every existing line are unchanged.docs/adr/README.md: one index row for ADR-0002 at proposed.Documentation only: no code, no changelog fragment (
changelog.d/README.mdexcludes ADRs).Direction check
Checked in turn, against
origin/mainat7ede3a2: every code claim in the record by anchor.StatifierDatamodel.Index.index/1admits any map with a list under"scopes"and returnsnilotherwise (lib/statifier_datamodel/index.ex,index/1); an unknown scope name indexes withscope: nil(scope_name/1);sensitive?readstrueonly for the boolean (normalize/5); a declaration whosekindis neitherrecordnorshapedeclares nothing (lib/statifier_datamodel/declarations.ex,declared_name/1); an entrytyperesolves against the private@typesmap first and then the document's declarations, and a spelling naming neither isnil(index.ex,entry_type/2);Index.type/2takes an index and a path; a non-integerversionindexes as1and an integer one is kept (index.ex,version/1); the Hexfiles:list lacksprivtoday (mix.exs,package/0); the comment abovedeps/0makes a runtime dependency a decision to record;changelog.d/README.mdnames a change to what the document admits as breaking. Each row of the worked-example table was checked against those functions over ADR-0001's worked shape (nine declared paths; eight without theeventscope). ADR-0001 decisions 3-6, 12, 13, its flip Note (the declarationlabelreading) and its inline-shape amendment arm (c) (no document spelling for an inline shape) were read whole for the schema's requirements.git diff origin/main -- docs/adr/shows zero removed lines;git diff origin/main --stat -- lib testis empty.Gate
Full
mix quality, quoted whole:The commit's tree is byte-identical to the tree this run was green on.
Provenance
Ruled by the operator, 2026-09-26: draft-07 with
ex_json_schema, hand-written with a drift test, and a record at proposed with the schema code built under it. Engineering choices this record makes where the ruling was silent:json/0returns the JSON text rather than a decoded map (the package decodes no JSON); the$idspelling; the version-2 file's name and reader are left to the bump that needs them.