Separate CalVer distributions from immutable schema versions

This commit is contained in:
2026-11-29 04:33:59 +00:00
parent f168d012e8
commit 053219b8da
12 changed files with 420 additions and 171 deletions

View File

@@ -12,7 +12,8 @@ source archive:
```sh
go mod download
go run ./cmd/validate examples/party.yml examples/campaign.yml examples/glossary.yml
go run ./cmd/validate -schema rpg/party@0.1.0 rpg/party/v0.1.0/examples/party.yml
go run ./cmd/validate -schema glossary@0.1.0 glossary/v0.1.0/examples/weather.yml
```
Dependencies are pinned in `go.mod` and `go.sum`. Once prepared, validation is
@@ -20,12 +21,15 @@ offline. A built tool can select another unpacked distribution:
```sh
go build -o /tmp/schemas-validate ./cmd/validate
/tmp/schemas-validate -root /path/to/schemas-v1.0.0 /path/to/completed-glossary.yml
/tmp/schemas-validate -root /path/to/distribution -schema glossary@0.1.0 /path/to/completed-glossary.yml
```
Select exactly `name@version` from [catalog.json](../catalog.json). All supplied
documents are validated against that definition, including their document marker.
Separate invocations select different schemas. Success reports the selected version.
Flags precede filenames. All files are checked even if an earlier file fails.
Exit 0 means all documents passed; 1 means a document could not be read or
validated; 2 means invalid command usage or an unusable schema set. Errors identify
validated; 2 means invalid command usage, missing/unknown selection, or an unusable distribution. Errors identify
the document and distinguish `decode`, `structure`, and `semantic`. Decoding
errors include field paths and source positions where the YAML library or node
profile provides them. Structural errors include JSON instance locations.
@@ -93,14 +97,15 @@ can use the document for a particular operation.
## Offline schema use and editors
Every schema declares Draft 2020-12 and an immutable release `$id`. The harness
Every schema declares Draft 2020-12 and an exact versioned canonical `$id`. The harness
registers the bundled schemas under those IDs before compiling them and rejects
unresolved resource loads. The schema engine supplies the standard meta-schema;
ordinary validation performs no network requests.
Other validators can likewise register local files under their `$id` values.
Keep the complete schema directory from one release together. Configure editors
externally to associate document paths with a local schema or its immutable raw
Bundle the selected version directories and their exact referenced dependencies
from one selected CalVer snapshot, with their adjacent semantic documents. Configure editors
externally to associate document paths with a local schema or its canonical versioned
URL. Operator documents use `schema_version`; they do not need a `$schema` field.
Schema validation supplies editor feedback for known fields. Optional tooling
can warn about likely misspellings without rejecting extensions.