Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f7e3cedeca | |||
| 1c59ea26a6 | |||
| 83fc22814d | |||
| 73ed94ea34 | |||
| d479df5d1d | |||
| bb88ca12d0 | |||
| d86c53cadd | |||
| 24cfdd76dd | |||
| d038562119 | |||
| dbc2697090 | |||
| ac21977996 | |||
| 4b0e72763f | |||
| 09db04d7f9 | |||
| f409bb1433 | |||
| 3cacffcfec |
@@ -9,3 +9,6 @@ this repository. Application composition, consumer migrations, prompts, and
|
|||||||
reference vocabulary belong elsewhere. Preserve the selected CC0 license and
|
reference vocabulary belong elsewhere. Preserve the selected CC0 license and
|
||||||
record the terms of incorporated material. Publishing requires an explicit
|
record the terms of incorporated material. Publishing requires an explicit
|
||||||
release request; see `docs/release.md`.
|
release request; see `docs/release.md`.
|
||||||
|
|
||||||
|
Before defining or revising a schema, follow the standing
|
||||||
|
[schema authoring boundary](docs/development.md#schema-authoring-boundary).
|
||||||
|
|||||||
24
README.md
24
README.md
@@ -4,16 +4,17 @@ Language-neutral contracts for shared domain inputs. Author information once in
|
|||||||
YAML or JSON and validate the completed document. Consumers own task-specific
|
YAML or JSON and validate the completed document. Consumers own task-specific
|
||||||
interpretations and projections.
|
interpretations and projections.
|
||||||
|
|
||||||
| Schema | Initial version | Document generation | Contract |
|
| Schema | Current version | Document generation | Contract |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| Glossary | 0.1.0 | `maximumdirect.glossary.v1` | [Schema](glossary/v0.1.0/schema.json), [semantics](glossary/v0.1.0/semantics.md), [examples](glossary/v0.1.0/examples/) |
|
| Glossary | 0.2.0 | `maximumdirect.glossary.v1` | [Schema](glossary/v0.2.0/schema.json), [semantics](glossary/v0.2.0/semantics.md), [examples](glossary/v0.2.0/examples/) |
|
||||||
| RPG party | 0.1.0 | `maximumdirect.rpg.party.v1` | [Schema](rpg/party/v0.1.0/schema.json), [semantics](rpg/party/v0.1.0/semantics.md), [examples](rpg/party/v0.1.0/examples/) |
|
| RPG party | 0.2.0 | `maximumdirect.rpg.party.v1` | [Schema](rpg/party/v0.2.0/schema.json), [semantics](rpg/party/v0.2.0/semantics.md), [examples](rpg/party/v0.2.0/examples/) |
|
||||||
| RPG campaign | 0.1.0 | `maximumdirect.rpg.campaign.v1` | [Schema](rpg/campaign/v0.1.0/schema.json), [semantics](rpg/campaign/v0.1.0/semantics.md), [examples](rpg/campaign/v0.1.0/examples/) |
|
| RPG campaign | 0.2.0 | `maximumdirect.rpg.campaign.v1` | [Schema](rpg/campaign/v0.2.0/schema.json), [semantics](rpg/campaign/v0.2.0/semantics.md), [examples](rpg/campaign/v0.2.0/examples/) |
|
||||||
|
|
||||||
[Catalog](catalog.json) lists exact versions; [catalog format](docs/catalog.md)
|
[Catalog](catalog.json) lists exact versions; [catalog format](docs/catalog.md)
|
||||||
defines its fields. Release `2026.11.0` contains these initial pre-stable versions.
|
defines its fields. Release `2026.11.1` contains the ConfigKit-aligned `0.2.0` versions.
|
||||||
|
Release `2026.11.0` retains the original published `0.1.0` contracts.
|
||||||
A schema's URL mirrors its repository path, such as
|
A schema's URL mirrors its repository path, such as
|
||||||
`https://schemas.maximumdirect.net/glossary/v0.1.0/schema.json`.
|
`https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json`.
|
||||||
Hosting serves raw content from `main`; visibility does not establish publication.
|
Hosting serves raw content from `main`; visibility does not establish publication.
|
||||||
Published CalVer tags and their inventories identify released versions.
|
Published CalVer tags and their inventories identify released versions.
|
||||||
|
|
||||||
@@ -23,13 +24,14 @@ Use Go 1.27 or later and prepare pinned dependencies:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
go mod download
|
go mod download
|
||||||
go run ./cmd/validate -schema rpg/party@0.1.0 rpg/party/v0.1.0/examples/party.yml
|
go run ./cmd/validate -schema rpg/party rpg/party/v0.2.0/examples/party.yml
|
||||||
go run ./cmd/validate -schema glossary@0.1.0 glossary/v0.1.0/examples/weather.yml
|
go run ./cmd/validate -schema glossary glossary/v0.2.0/examples/weather.yml
|
||||||
go test ./...
|
go test ./...
|
||||||
```
|
```
|
||||||
|
|
||||||
[Validation](docs/validation.md) defines the YAML profile and error boundaries.
|
[Validation](docs/validation.md) defines native loading and error boundaries.
|
||||||
ConfigKit owns composition before the completed-document handoff. The harness
|
ConfigKit v1.4.0 owns acquisition and resolution through the completed-document
|
||||||
|
handoff; its pinned contract is linked from the validation guide. The harness
|
||||||
is a development tool, not a consumer SDK.
|
is a development tool, not a consumer SDK.
|
||||||
|
|
||||||
## Select a distribution
|
## Select a distribution
|
||||||
@@ -40,7 +42,7 @@ See [compatibility](docs/compatibility.md) and the [release procedure](docs/rele
|
|||||||
The internal Go module is only tooling and has no schema-version semantics.
|
The internal Go module is only tooling and has no schema-version semantics.
|
||||||
|
|
||||||
Select a published archive, for example
|
Select a published archive, for example
|
||||||
`https://forge.maximumdirect.net/eric/schemas/archive/2026.11.0.tar.gz`.
|
`https://forge.maximumdirect.net/eric/schemas/archive/2026.11.1.tar.gz`.
|
||||||
Record that distribution and the exact selected schema versions.
|
Record that distribution and the exact selected schema versions.
|
||||||
Bundle those directories, their referenced dependencies, and semantic documents
|
Bundle those directories, their referenced dependencies, and semantic documents
|
||||||
for offline use. An unrelated schema update need not trigger a consumer upgrade.
|
for offline use. An unrelated schema update need not trigger a consumer upgrade.
|
||||||
|
|||||||
45
catalog.json
45
catalog.json
@@ -1,8 +1,47 @@
|
|||||||
{
|
{
|
||||||
"format_version": 1,
|
"format_version": 1,
|
||||||
"schemas": [
|
"schemas": [
|
||||||
{"name": "glossary", "version": "0.1.0", "contract": "maximumdirect.glossary.v1", "id": "https://schemas.maximumdirect.net/glossary/v0.1.0/schema.json", "path": "glossary/v0.1.0/schema.json"},
|
{
|
||||||
{"name": "rpg/party", "version": "0.1.0", "contract": "maximumdirect.rpg.party.v1", "id": "https://schemas.maximumdirect.net/rpg/party/v0.1.0/schema.json", "path": "rpg/party/v0.1.0/schema.json"},
|
"name": "glossary",
|
||||||
{"name": "rpg/campaign", "version": "0.1.0", "contract": "maximumdirect.rpg.campaign.v1", "id": "https://schemas.maximumdirect.net/rpg/campaign/v0.1.0/schema.json", "path": "rpg/campaign/v0.1.0/schema.json"}
|
"version": "0.1.0",
|
||||||
|
"contract": "maximumdirect.glossary.v1",
|
||||||
|
"id": "https://schemas.maximumdirect.net/glossary/v0.1.0/schema.json",
|
||||||
|
"path": "glossary/v0.1.0/schema.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rpg/party",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contract": "maximumdirect.rpg.party.v1",
|
||||||
|
"id": "https://schemas.maximumdirect.net/rpg/party/v0.1.0/schema.json",
|
||||||
|
"path": "rpg/party/v0.1.0/schema.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rpg/campaign",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"contract": "maximumdirect.rpg.campaign.v1",
|
||||||
|
"id": "https://schemas.maximumdirect.net/rpg/campaign/v0.1.0/schema.json",
|
||||||
|
"path": "rpg/campaign/v0.1.0/schema.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "glossary",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"contract": "maximumdirect.glossary.v1",
|
||||||
|
"id": "https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json",
|
||||||
|
"path": "glossary/v0.2.0/schema.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rpg/party",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"contract": "maximumdirect.rpg.party.v1",
|
||||||
|
"id": "https://schemas.maximumdirect.net/rpg/party/v0.2.0/schema.json",
|
||||||
|
"path": "rpg/party/v0.2.0/schema.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rpg/campaign",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"contract": "maximumdirect.rpg.campaign.v1",
|
||||||
|
"id": "https://schemas.maximumdirect.net/rpg/campaign/v0.2.0/schema.json",
|
||||||
|
"path": "rpg/campaign/v0.2.0/schema.json"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ func run(args []string, stdout, stderr io.Writer) int {
|
|||||||
flags := flag.NewFlagSet("validate", flag.ContinueOnError)
|
flags := flag.NewFlagSet("validate", flag.ContinueOnError)
|
||||||
flags.SetOutput(stderr)
|
flags.SetOutput(stderr)
|
||||||
root := flags.String("root", ".", "unpacked distribution root (contains catalog.json)")
|
root := flags.String("root", ".", "unpacked distribution root (contains catalog.json)")
|
||||||
selection := flags.String("schema", "", "exact schema name@version from catalog.json")
|
selection := flags.String("schema", "", "schema name; selects its highest local SemVer")
|
||||||
flags.Usage = func() {
|
flags.Usage = func() {
|
||||||
fmt.Fprintln(stderr, "Usage: validate [-root DIRECTORY] -schema NAME@VERSION DOCUMENT...")
|
fmt.Fprintln(stderr, "Usage: validate [-root DIRECTORY] -schema NAME DOCUMENT...")
|
||||||
flags.PrintDefaults()
|
flags.PrintDefaults()
|
||||||
}
|
}
|
||||||
if err := flags.Parse(args); err != nil {
|
if err := flags.Parse(args); err != nil {
|
||||||
@@ -52,7 +52,7 @@ func run(args []string, stdout, stderr io.Writer) int {
|
|||||||
}
|
}
|
||||||
var value any
|
var value any
|
||||||
if err == nil {
|
if err == nil {
|
||||||
value, err = validation.Decode(data)
|
value, err = validation.LoadDomain(file, data)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = schema.Validate(value)
|
err = schema.Validate(value)
|
||||||
@@ -62,7 +62,7 @@ func run(args []string, stdout, stderr io.Writer) int {
|
|||||||
status = 1
|
status = 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Fprintf(stdout, "%s: valid (%s; %s)\n", file, *selection, schema.Record.Contract)
|
fmt.Fprintf(stdout, "%s: valid (%s@%s; %s)\n", file, schema.Record.Name, schema.Record.Version, schema.Record.Contract)
|
||||||
}
|
}
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,18 +19,18 @@ func TestCommand(t *testing.T) {
|
|||||||
out string
|
out string
|
||||||
err string
|
err string
|
||||||
}{
|
}{
|
||||||
{"valid", []string{"-root", "../..", "-schema", "rpg/party@0.1.0", "../../rpg/party/v0.1.0/examples/party.yml"}, 0, "valid (rpg/party@0.1.0; maximumdirect.rpg.party.v1)", ""},
|
{"valid", []string{"-root", "../..", "-schema", "rpg/party", "../../rpg/party/v0.1.0/examples/party.yml"}, 0, "valid (rpg/party@0.2.0; maximumdirect.rpg.party.v1)", ""},
|
||||||
{"continue after failure", []string{"-root", "../..", "-schema", "glossary@0.1.0", "../../tests/invalid/semantic-duplicate-id.yml", "../../glossary/v0.1.0/examples/weather.json"}, 1, "weather.json: valid", "semantic:"},
|
{"continue after failure", []string{"-root", "../..", "-schema", "glossary", "../../tests/invalid/semantic-duplicate-id.yml", "../../glossary/v0.1.0/examples/weather.json"}, 1, "weather.json: valid", "semantic:"},
|
||||||
{"structural", []string{"-root", "../..", "-schema", "glossary@0.1.0", "../../tests/invalid/structure-missing-name.yml"}, 1, "", "structure:"},
|
{"structural", []string{"-root", "../..", "-schema", "glossary", "../../tests/invalid/structure-missing-name.yml"}, 1, "", "structure:"},
|
||||||
{"decode", []string{"-root", "../..", "-schema", "rpg/campaign@0.1.0", "../../tests/invalid/decode-duplicate-key.yml"}, 1, "", "decode:"},
|
{"decode", []string{"-root", "../..", "-schema", "rpg/campaign", "../../tests/invalid/decode-duplicate-key.yml"}, 1, "", "load:"},
|
||||||
{"file missing", []string{"-root", "../..", "-schema", "rpg/campaign@0.1.0", filepath.Join(t.TempDir(), "missing.yml")}, 1, "", "missing.yml"},
|
{"file missing", []string{"-root", "../..", "-schema", "rpg/campaign", filepath.Join(t.TempDir(), "missing.yml")}, 1, "", "missing.yml"},
|
||||||
{"missing selection", []string{"-root", "../..", "../../rpg/party/v0.1.0/examples/party.yml"}, 2, "", "Usage:"},
|
{"missing selection", []string{"-root", "../..", "../../rpg/party/v0.1.0/examples/party.yml"}, 2, "", "Usage:"},
|
||||||
{"unknown selection", []string{"-root", "../..", "-schema", "rpg/party@9.0.0", "../../rpg/party/v0.1.0/examples/party.yml"}, 2, "", "schema selection:"},
|
{"unknown selection", []string{"-root", "../..", "-schema", "rpg/party@9.0.0", "../../rpg/party/v0.1.0/examples/party.yml"}, 2, "", "schema selection:"},
|
||||||
{"marker mismatch", []string{"-root", "../..", "-schema", "glossary@0.1.0", "../../rpg/party/v0.1.0/examples/party.yml"}, 1, "", "structure:"},
|
{"marker mismatch", []string{"-root", "../..", "-schema", "glossary", "../../rpg/party/v0.1.0/examples/party.yml"}, 1, "", "structure:"},
|
||||||
{"no documents", nil, 2, "", "Usage:"},
|
{"no documents", nil, 2, "", "Usage:"},
|
||||||
{"bad flag", []string{"-unknown"}, 2, "", "flag provided"},
|
{"bad flag", []string{"-unknown"}, 2, "", "flag provided"},
|
||||||
{"help", []string{"-h"}, 0, "", "Usage:"},
|
{"help", []string{"-h"}, 0, "", "Usage:"},
|
||||||
{"missing set", []string{"-root", t.TempDir(), "-schema", "rpg/party@0.1.0", "../../rpg/party/v0.1.0/examples/party.yml"}, 2, "", "schema set:"},
|
{"missing set", []string{"-root", t.TempDir(), "-schema", "rpg/party", "../../rpg/party/v0.1.0/examples/party.yml"}, 2, "", "schema set:"},
|
||||||
} {
|
} {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
@@ -81,8 +81,8 @@ func TestExactDefinitions(t *testing.T) {
|
|||||||
if err := json.Unmarshal(data, &schema); err != nil {
|
if err := json.Unmarshal(data, &schema); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
glossary.Version = "0.2.0"
|
glossary.Version = "99.0.0"
|
||||||
glossary.Path = "glossary/v0.2.0/schema.json"
|
glossary.Path = "glossary/v99.0.0/schema.json"
|
||||||
glossary.ID = "https://schemas.maximumdirect.net/" + glossary.Path
|
glossary.ID = "https://schemas.maximumdirect.net/" + glossary.Path
|
||||||
schema["$id"] = glossary.ID
|
schema["$id"] = glossary.ID
|
||||||
schema["required"] = []string{"schema_version", "collections", "synthetic_test_field"}
|
schema["required"] = []string{"schema_version", "collections", "synthetic_test_field"}
|
||||||
@@ -98,7 +98,7 @@ func TestExactDefinitions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
write("catalog.json", data)
|
write("catalog.json", data)
|
||||||
write("document.json", []byte(`{"schema_version":"maximumdirect.glossary.v1","collections":{}}`))
|
write("document.json", []byte(`{"schema_version":"maximumdirect.glossary.v1","collections":{}}`))
|
||||||
for selection, want := range map[string]int{"glossary@0.1.0": 0, "glossary@0.2.0": 1} {
|
for selection, want := range map[string]int{"glossary": 1, "glossary@0.1.0": 2, "glossary@99.0.0": 2} {
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
if got := run([]string{"-root", root, "-schema", selection, filepath.Join(root, "document.json")}, &stdout, &stderr); got != want {
|
if got := run([]string{"-root", root, "-schema", selection, filepath.Join(root, "document.json")}, &stdout, &stderr); got != want {
|
||||||
t.Fatalf("%s exit %d, want %d: %s", selection, got, want, &stderr)
|
t.Fatalf("%s exit %d, want %d: %s", selection, got, want, &stderr)
|
||||||
@@ -112,7 +112,7 @@ func TestJSONSyntax(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
if run([]string{"-root", "../..", "-schema", "rpg/campaign@0.1.0", file}, &stdout, &stderr) != 1 || !strings.Contains(stderr.String(), "decode: expected JSON syntax") {
|
if run([]string{"-root", "../..", "-schema", "rpg/campaign", file}, &stdout, &stderr) != 1 || !strings.Contains(stderr.String(), "decode: expected JSON syntax") {
|
||||||
t.Fatalf("expected JSON syntax failure, got %q", &stderr)
|
t.Fatalf("expected JSON syntax failure, got %q", &stderr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,8 @@ func TestDocumentDecoding(t *testing.T) {
|
|||||||
body string
|
body string
|
||||||
code int
|
code int
|
||||||
}{
|
}{
|
||||||
{"escaped.json", `{"schema_version":"maximumdirect.rpg.campaign.v1","id":"weather","name":"Weather \ud83c\udf27"}`, 0},
|
{"literal.json", `{"schema_version":"maximumdirect.rpg.campaign.v1","id":"weather","name":"Weather 🌧"}`, 0},
|
||||||
|
{"escaped.json", `{"schema_version":"maximumdirect.rpg.campaign.v1","id":"weather","name":"Weather \ud83c\udf27"}`, 1},
|
||||||
{"malformed-float.yml", "schema_version: maximumdirect.rpg.campaign.v1\nid: weather\nreading: !!float e3\n", 1},
|
{"malformed-float.yml", "schema_version: maximumdirect.rpg.campaign.v1\nid: weather\nreading: !!float e3\n", 1},
|
||||||
} {
|
} {
|
||||||
t.Run(test.file, func(t *testing.T) {
|
t.Run(test.file, func(t *testing.T) {
|
||||||
@@ -132,13 +133,13 @@ func TestDocumentDecoding(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
if code := run([]string{"-root", "../..", "-schema", "rpg/campaign@0.1.0", file}, &stdout, &stderr); code != test.code {
|
if code := run([]string{"-root", "../..", "-schema", "rpg/campaign", file}, &stdout, &stderr); code != test.code {
|
||||||
t.Fatalf("want exit %d, got %d: stdout=%q stderr=%q", test.code, code, &stdout, &stderr)
|
t.Fatalf("want exit %d, got %d: stdout=%q stderr=%q", test.code, code, &stdout, &stderr)
|
||||||
}
|
}
|
||||||
if test.code == 0 && !strings.Contains(stdout.String(), "valid (rpg/campaign@0.1.0; maximumdirect.rpg.campaign.v1)") {
|
if test.code == 0 && !strings.Contains(stdout.String(), "valid (rpg/campaign@0.2.0; maximumdirect.rpg.campaign.v1)") {
|
||||||
t.Fatalf("missing success report: %q", &stdout)
|
t.Fatalf("missing success report: %q", &stdout)
|
||||||
}
|
}
|
||||||
if test.code != 0 && !strings.Contains(stderr.String(), "decode:") {
|
if test.code != 0 && !strings.Contains(stderr.String(), "load:") {
|
||||||
t.Fatalf("missing decoding failure: %q", &stderr)
|
t.Fatalf("missing decoding failure: %q", &stderr)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ per independent schema version. Each record has:
|
|||||||
|
|
||||||
The ID equals the canonical domain plus the path. `semantics.md` and `examples/`
|
The ID equals the canonical domain plus the path. `semantics.md` and `examples/`
|
||||||
are adjacent to each schema. Multiple versions may share a document generation;
|
are adjacent to each schema. Multiple versions may share a document generation;
|
||||||
select exactly `name@version` rather than inferring a definition from the marker.
|
consumers pin exact versions rather than inferring a definition from the marker.
|
||||||
|
The developer CLI selects the highest local SemVer by `-schema NAME` and reports
|
||||||
|
its exact version. It has no historical selection mode or automatic download.
|
||||||
|
|
||||||
The inventory includes every active versioned schema root and all retained
|
The inventory includes every active versioned schema root and all retained
|
||||||
published versions. Names/versions, IDs, and paths are unique. Historical origin
|
published versions. Names/versions, IDs, and paths are unique. Historical origin
|
||||||
|
|||||||
@@ -16,12 +16,19 @@ at `0.1.0`. These independent schema versions remain pre-stable.
|
|||||||
- Canonical schema identity: `https://schemas.maximumdirect.net/` plus the exact
|
- Canonical schema identity: `https://schemas.maximumdirect.net/` plus the exact
|
||||||
repository-relative schema path. It stays unchanged across repository snapshots.
|
repository-relative schema path. It stays unchanged across repository snapshots.
|
||||||
|
|
||||||
A compatible schema update retains its document marker. Incompatible structure
|
Document generations follow independent schema major versions. Pre-1.0 and 1.x
|
||||||
or meaning changes the affected marker, including during pre-stable development.
|
schemas use `.v1`; schema 2.0.0 begins `.v2`. Pre-1.0 contract changes require
|
||||||
Independent stable schemas use SemVer: major for incompatibility, minor for
|
a new schema version and migration guidance, but retain the marker. Stable
|
||||||
compatible additions, patch for compatible corrections. Pre-stable versions
|
schemas follow SemVer: incompatible changes require a major, compatible
|
||||||
express developing maturity; `1.0.0` is selected when adoption establishes a
|
additions a minor, and compatible corrections a patch. The Go module identity
|
||||||
stable contract. Document generation is not derived from schema or Go module major.
|
is independent of these schema versions.
|
||||||
|
|
||||||
|
Release `2026.11.1` adds `0.2.0` versions retaining the `.v1` markers while adopting
|
||||||
|
ConfigKit v1.4.0's native mapping handoff. Supported values, syntax, reserved
|
||||||
|
controls, and numeric precision follow that pinned baseline. RPG party levels
|
||||||
|
gain the int64 maximum. See [validation](validation.md) for migration advice and
|
||||||
|
the original guide/tool for historical full conformance. New semantic documents
|
||||||
|
pin their upstream boundary independently of future repository guidance.
|
||||||
|
|
||||||
## Published contracts
|
## Published contracts
|
||||||
|
|
||||||
@@ -40,7 +47,7 @@ independent of source publication.
|
|||||||
|
|
||||||
Select a published CalVer archive and exact `name@version` entries from its
|
Select a published CalVer archive and exact `name@version` entries from its
|
||||||
[catalog](catalog.md). For example, select `glossary@0.1.0` from `2026.11.0`
|
[catalog](catalog.md). For example, select `glossary@0.1.0` from `2026.11.0`
|
||||||
after that distribution is published. Bundle `glossary/v0.1.0/` with its schema,
|
using that distribution's original contracts. Bundle `glossary/v0.1.0/` with its schema,
|
||||||
semantic document, and any exact-version dependency directories referenced by
|
semantic document, and any exact-version dependency directories referenced by
|
||||||
the schema. Register canonical IDs against bundled files for offline resolution.
|
the schema. Register canonical IDs against bundled files for offline resolution.
|
||||||
No Go module dependency is required.
|
No Go module dependency is required.
|
||||||
@@ -52,8 +59,8 @@ be ignored. Migration is explicit, with no automatic conversion or legacy reader
|
|||||||
|
|
||||||
A new consumer reads supported older documents. An older consumer may preserve
|
A new consumer reads supported older documents. An older consumer may preserve
|
||||||
new optional extensions without interpreting them. Additions are compatible only
|
new optional extensions without interpreting them. Additions are compatible only
|
||||||
when ignoring them preserves known meanings; otherwise select a new contract
|
when ignoring them preserves known meanings; otherwise apply the pre-stable or stable version-transition rules above,
|
||||||
generation or an explicitly selected extension contract. Forwarded documents
|
or select an explicitly defined extension contract. Forwarded documents
|
||||||
preserve extensions; task-specific projections may omit them. Consumers may
|
preserve extensions; task-specific projections may omit them. Consumers may
|
||||||
require more data for a particular operation than schema conformance requires.
|
require more data for a particular operation than schema conformance requires.
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ go test ./...
|
|||||||
go vet ./...
|
go vet ./...
|
||||||
```
|
```
|
||||||
|
|
||||||
`go test ./...` compiles and meta-validates all schemas, validates all examples
|
`go test ./...` compiles and meta-validates all schemas, validates every current version's examples through native ConfigKit loading
|
||||||
and fixtures, checks semantic uniqueness and YAML/JSON equivalence, exercises
|
and checks active fixtures, checks semantic uniqueness and YAML/JSON equivalence, exercises
|
||||||
decoding and CLI failures, and checks that distribution content and local
|
decoding and CLI failures, and checks that distribution content and local
|
||||||
documentation links are present. Tests are offline and use synthetic data.
|
documentation links are present. Tests are offline and use synthetic data.
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ original checkout so missing files and accidental outside references are caught.
|
|||||||
- `tests/valid/`: valid compatibility fixtures.
|
- `tests/valid/`: valid compatibility fixtures.
|
||||||
- `tests/invalid/`: focused invalid documents; prefixes identify failure phase.
|
- `tests/invalid/`: focused invalid documents; prefixes identify failure phase.
|
||||||
- `internal/validation/`: local YAML profile, schema registration, semantic check.
|
- `internal/validation/`: local YAML profile, schema registration, semantic check.
|
||||||
- `cmd/validate/`: exact-version developer CLI; no consumer SDK.
|
- `cmd/validate/`: most-current local version selection by schema name; no consumer SDK.
|
||||||
- `internal/publication/` and `cmd/check-published/`: separate Git history checks
|
- `internal/publication/` and `cmd/check-published/`: separate Git history checks
|
||||||
used only in explicitly requested release preparation.
|
used only in explicitly requested release preparation.
|
||||||
|
|
||||||
@@ -47,3 +47,19 @@ for their features. Use original synthetic examples. Before incorporating source
|
|||||||
material, record its origin, revision, applicable license, and modifications in
|
material, record its origin, revision, applicable license, and modifications in
|
||||||
[attribution](oss/attribution.md); the repository's CC0 choice does not change
|
[attribution](oss/attribution.md); the repository's CC0 choice does not change
|
||||||
third-party terms. New code and prose here are dedicated under [CC0](../COPYRIGHT).
|
third-party terms. New code and prose here are dedicated under [CC0](../COPYRIGHT).
|
||||||
|
|
||||||
|
## Schema authoring boundary
|
||||||
|
|
||||||
|
Every new schema or revision conforms to the pinned ConfigKit acquisition and
|
||||||
|
mapping-root handoff described in [validation](validation.md). Review field
|
||||||
|
types, numeric ranges and precision promises, reserved names/controls, and
|
||||||
|
extension values before publication. Resolve differences in the proposed
|
||||||
|
contract rather than introducing a decoder or compatibility adapter. Pin that
|
||||||
|
upstream baseline in each new version's semantic document.
|
||||||
|
|
||||||
|
Supply representative examples and focused boundary fixtures for new constraints.
|
||||||
|
The catalog drives native example checks for the highest version of each name;
|
||||||
|
missing or incompatible examples fail. Historical resources still compile offline.
|
||||||
|
Tests supply evidence, not a proof covering every accepted document. Repeat this
|
||||||
|
review and the same ordinary checks when upgrading ConfigKit. Broad-profile
|
||||||
|
fixtures under `tests/historical/` document the original tool only.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Narratio reference catalog
|
## Narratio reference catalog
|
||||||
|
|
||||||
Material: `glossary/v0.1.0/schema.json`, adapted from the catalog's glossary-v1
|
Material: `glossary/v0.1.0/schema.json` and `glossary/v0.2.0/schema.json`, adapted from the catalog's glossary-v1
|
||||||
schema at `a1a87edafd59a1de545a1c0b4efe5feeb80348e0`. The unmodified source is
|
schema at `a1a87edafd59a1de545a1c0b4efe5feeb80348e0`. The unmodified source is
|
||||||
retained in `docs/origins/reference-catalog-glossary-v1.schema.json`. The shared
|
retained in `docs/origins/reference-catalog-glossary-v1.schema.json`. The shared
|
||||||
envelope, defined fields, provenance, and structural extension behavior were changed.
|
envelope, defined fields, provenance, and structural extension behavior were changed.
|
||||||
@@ -15,7 +15,7 @@ License and notices: [CC0 1.0](../../LICENSE).
|
|||||||
|
|
||||||
## go-yaml
|
## go-yaml
|
||||||
|
|
||||||
Selected module: `go.yaml.in/yaml/v4` at `v4.0.0`.
|
Selected module: `go.yaml.in/yaml/v4` at `v4.0.0` (transitive dependency).
|
||||||
|
|
||||||
Copyright 2006-2010 Kirill Simonov
|
Copyright 2006-2010 Kirill Simonov
|
||||||
|
|
||||||
@@ -50,3 +50,27 @@ SPDX-License-Identifier: BSD-3-Clause
|
|||||||
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) | [LICENSE](https://go.googlesource.com/text/+/6c97a165dd661335ff7bce6104a008558123c353/LICENSE) | [PATENTS](https://go.googlesource.com/text/+/6c97a165dd661335ff7bce6104a008558123c353/PATENTS).
|
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) | [LICENSE](https://go.googlesource.com/text/+/6c97a165dd661335ff7bce6104a008558123c353/LICENSE) | [PATENTS](https://go.googlesource.com/text/+/6c97a165dd661335ff7bce6104a008558123c353/PATENTS).
|
||||||
|
|
||||||
[Source](https://go.googlesource.com/text/+/6c97a165dd661335ff7bce6104a008558123c353).
|
[Source](https://go.googlesource.com/text/+/6c97a165dd661335ff7bce6104a008558123c353).
|
||||||
|
|
||||||
|
## ConfigKit
|
||||||
|
|
||||||
|
Selected module: `go.maximumdirect.net/configkit` at `v1.4.0`.
|
||||||
|
|
||||||
|
Copyright (C) 2026 Eric Rakestraw
|
||||||
|
|
||||||
|
SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) | [GPL 3.0](licenses/GPL-3.0.txt) | [COPYRIGHT](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/COPYRIGHT) | [LICENSE](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/LICENSE).
|
||||||
|
|
||||||
|
[Source](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3).
|
||||||
|
|
||||||
|
## Go mod
|
||||||
|
|
||||||
|
Selected module: `golang.org/x/mod` at `v0.43.0`.
|
||||||
|
|
||||||
|
Copyright 2009 The Go Authors.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause-mod.txt) | [LICENSE](https://go.googlesource.com/mod/+/d4f320b9266480df5ed3d791e0c68e64c58c5dde/LICENSE).
|
||||||
|
|
||||||
|
[Source](https://go.googlesource.com/mod/+/d4f320b9266480df5ed3d791e0c68e64c58c5dde).
|
||||||
|
|||||||
27
docs/oss/licenses/BSD-3-Clause-mod.txt
Normal file
27
docs/oss/licenses/BSD-3-Clause-mod.txt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
Copyright 2009 The Go Authors.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google LLC nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
674
docs/oss/licenses/GPL-3.0.txt
Normal file
674
docs/oss/licenses/GPL-3.0.txt
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
165
docs/oss/licenses/LGPL-3.0.txt
Normal file
165
docs/oss/licenses/LGPL-3.0.txt
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
45
docs/releases/2026.11.1.md
Normal file
45
docs/releases/2026.11.1.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Maximum Direct shared schemas 2026.11.1
|
||||||
|
|
||||||
|
Publication date (UTC): 2026-11-29.
|
||||||
|
|
||||||
|
## Aligned schema versions
|
||||||
|
|
||||||
|
- `glossary@0.2.0`: `maximumdirect.glossary.v1`.
|
||||||
|
- `rpg/party@0.2.0`: `maximumdirect.rpg.party.v1`.
|
||||||
|
- `rpg/campaign@0.2.0`: `maximumdirect.rpg.campaign.v1`.
|
||||||
|
|
||||||
|
These pre-stable versions adopt ConfigKit v1.4.0's native mapping-root handoff.
|
||||||
|
Domain values pass directly from native acquisition to structural and semantic
|
||||||
|
validation. The custom broader-profile domain decoders have been removed.
|
||||||
|
Schema resource JSON retains exact numeric constraints independently of domain
|
||||||
|
numeric binding. All published `0.1.0` directories and their catalog records
|
||||||
|
remain unchanged and available for consumers pinning them.
|
||||||
|
|
||||||
|
## Migration
|
||||||
|
|
||||||
|
The validator now accepts `-schema NAME` and selects the highest local SemVer,
|
||||||
|
reporting its exact version. For example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
go run ./cmd/validate -schema glossary glossary/v0.2.0/examples/weather.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
`NAME@VERSION` CLI selection is removed. Consumer pinning of exact schema versions
|
||||||
|
and a source distribution remains independent of this developer-tool behavior.
|
||||||
|
Historical full validation uses the tool from `2026.11.0`; selecting an old root
|
||||||
|
with the new tool does not restore historical decoding.
|
||||||
|
|
||||||
|
Quote ambiguous strings and use ConfigKit-supported syntax. Explicit tags,
|
||||||
|
anchors, aliases, reserved controls, JSON serialization, source limits, and
|
||||||
|
numeric values follow the pinned native boundary. Dynamic integer syntax binds
|
||||||
|
to int64 and fractional/exponent syntax to finite float64, which may round.
|
||||||
|
RPG party class levels retain their positive-integer rule and gain an int64
|
||||||
|
maximum of `9223372036854775807` after native binding.
|
||||||
|
|
||||||
|
Document markers remain `.v1` under the revised pre-stable compatibility policy.
|
||||||
|
The unchanged marker does not imply unchanged acquisition behavior. Review the
|
||||||
|
[validation guide](../validation.md), [compatibility guidance](../compatibility.md),
|
||||||
|
and each selected version's semantic document before upgrading. Consumer
|
||||||
|
application adoption remains separate work; no compatibility shim is supplied.
|
||||||
|
|
||||||
|
[COPYRIGHT](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.1/COPYRIGHT) | [LICENSE](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.1/LICENSE) | [ATTRIBUTION](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.1/docs/oss/attribution.md)
|
||||||
281
docs/roadmap/configkit-alignment.md
Normal file
281
docs/roadmap/configkit-alignment.md
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
# Align shared schemas with ConfigKit
|
||||||
|
|
||||||
|
Status: implemented locally; [completion evidence](implementation.md#execution-status)
|
||||||
|
recorded. Publication and consumer adoption remain separate work.
|
||||||
|
|
||||||
|
## Objective and ownership
|
||||||
|
|
||||||
|
Make all three shared contracts usable through ConfigKit's existing public
|
||||||
|
loading and handoff APIs. ConfigKit defines supported input syntax, values, and
|
||||||
|
configuration resolution. The schemas collection defines domain structure and
|
||||||
|
meaning within that boundary. Consumers own task-specific interpretation.
|
||||||
|
|
||||||
|
The schemas must conform to ConfigKit, not require ConfigKit to adopt the
|
||||||
|
collection's broader decoding profile. Do not add consumer compatibility
|
||||||
|
adapters, a replacement parser, scalar repair, arbitrary-precision handling, or
|
||||||
|
serialization round trips to bridge a difference. Unsupported capabilities must
|
||||||
|
be removed from the new contracts' promises.
|
||||||
|
|
||||||
|
This work covers glossary, RPG party, RPG campaign, their documentation and
|
||||||
|
examples, and the repository's validation harness. Consumer adoption and release
|
||||||
|
publication remain separate work. The contracts remain language-neutral;
|
||||||
|
ConfigKit's Go API is the reference implementation used by this repository's
|
||||||
|
internal tooling, not a schema SDK for consumers.
|
||||||
|
|
||||||
|
## Reviewed baseline
|
||||||
|
|
||||||
|
- Schemas distribution `2026.11.0`, commit
|
||||||
|
`1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`: all three schemas are `0.1.0`.
|
||||||
|
- ConfigKit `v1.4.0`, commit
|
||||||
|
`4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3`:
|
||||||
|
[configuration contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md)
|
||||||
|
and [consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md).
|
||||||
|
|
||||||
|
Review included the three schemas and semantic documents, the custom decoder,
|
||||||
|
validation and CLI paths, maintained fixtures, and temporary executable probes
|
||||||
|
using ConfigKit's public `Load[map[string]any]` and `Bytes` APIs. No ConfigKit
|
||||||
|
change is required for the proposed loading path.
|
||||||
|
|
||||||
|
### Findings
|
||||||
|
|
||||||
|
| Area | Current schemas behavior | ConfigKit boundary and required alignment |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| YAML scalars | Case variants of booleans/null and unquoted `yes`, `no`, `on`, `off` are accepted under the local profile. | Follow native scalar classification. Quote these words when intended as strings; do not translate unsupported spellings. |
|
||||||
|
| YAML numeric syntax | Hexadecimal, octal, binary, separators, leading plus, and leading/trailing decimal dots are normalized. | Use ConfigKit's accepted JSON decimal number spellings. Remove normalization. |
|
||||||
|
| Tags and aliases | Standard explicit tags and acyclic aliases are accepted. | ConfigKit rejects explicit tags, anchors, and aliases. New examples and fixtures must reflect this. |
|
||||||
|
| Mapping keys | The local profile permits a quoted `<<` extension key. | ConfigKit rejects that key even when quoted. Duplicate keys and non-string keys remain errors. |
|
||||||
|
| Numeric values | `json.Number` preserves arbitrary precision, including integers beyond `int64` and `1e500`. | The native dynamic handoff uses `int64` integers and finite `float64` fractional/exponent values. Oversized values can fail; decimal precision can change. Do not promise exact authored numeric preservation. |
|
||||||
|
| Party class levels | Positive integers have no upper bound. | Bound the defined field to the supported dynamic integer range; retain its positive-integer domain rule. |
|
||||||
|
| Extension fields | All objects allow extensions and promise broad value preservation. | Keep extensions, but apply native value limits and reserved controls recursively. Preserve resolved supported values, not every authored representation. |
|
||||||
|
| Configuration controls | Completed documents are treated as arbitrary data mappings. | `extends` is always structural input; source-root `config` is a control namespace. Disabling imports does not make these ordinary extension data. |
|
||||||
|
| JSON | A separate JSON decoder accepts forms rejected by ConfigKit's parser. | Route JSON documents through the same native boundary. Do not promise acceptance of every JSON serialization. |
|
||||||
|
| Harness | A custom YAML node walker and JSON token walker implement a broader profile. | Replace domain decoding with native ConfigKit loading; retain maintained JSON Schema validation and domain semantic checks. |
|
||||||
|
|
||||||
|
Probes confirmed that a maximum `int64` succeeds while the next integer and
|
||||||
|
`1e500` fail; `0.123456789012345678901234567890` becomes
|
||||||
|
`0.12345678901234568`. They also confirmed that `extends: null` is consumed,
|
||||||
|
sibling inheritance resolves without enabling imports, and root
|
||||||
|
`config: {note: ordinary}` fails. A JSON surrogate-pair escape fails while the
|
||||||
|
equivalent literal Unicode character succeeds. These findings identify the
|
||||||
|
baseline's limits; do not turn incidental error wording into repository policy.
|
||||||
|
|
||||||
|
Glossary and campaign defined fields already use supported strings, objects,
|
||||||
|
arrays, and null where specified. Their changes concern the common loading,
|
||||||
|
extension, and preservation contract. Party additionally needs the explicit
|
||||||
|
class-level bound. Existing domain meanings need no redesign.
|
||||||
|
|
||||||
|
## Required work
|
||||||
|
|
||||||
|
### Common loading boundary
|
||||||
|
|
||||||
|
Replace the independently specified broad YAML profile with a short description
|
||||||
|
that delegates to the pinned ConfigKit contract. Record the supported ConfigKit
|
||||||
|
baseline and link its canonical guidance. Future schema additions and updates
|
||||||
|
must be checked against that boundary before publication.
|
||||||
|
|
||||||
|
Make this a standing schema-authoring requirement in `docs/development.md`,
|
||||||
|
with a link from `AGENTS.md` so future contributors encounter it before defining
|
||||||
|
a contract. Every new schema or revision must review its field types, numeric
|
||||||
|
ranges and precision promises, extension values, and reserved names against the
|
||||||
|
selected ConfigKit boundary. Resolve incompatibilities in the proposed schema;
|
||||||
|
do not add a schema-specific decoder or broaden the shared loading path.
|
||||||
|
|
||||||
|
Extend the ordinary validation suite to discover newly added schema versions
|
||||||
|
through the catalog and exercise their examples through the same native loading,
|
||||||
|
structural validation, and applicable semantic checks. Require representative
|
||||||
|
examples and focused boundary fixtures for new field constraints. This must
|
||||||
|
apply to future schemas without maintaining a hard-coded list of the current
|
||||||
|
three. Run native document checks against the most current version of each
|
||||||
|
schema; retained historical definitions are not alternate validation targets.
|
||||||
|
|
||||||
|
These checks verify examples and relevant boundaries, not every document a JSON
|
||||||
|
Schema could accept. Contributor guidance must retain the contract review above;
|
||||||
|
passing meta-schema validation or a few examples is not proof of full native
|
||||||
|
compatibility. Run the same checks when upgrading ConfigKit.
|
||||||
|
|
||||||
|
Distinguish three checks:
|
||||||
|
|
||||||
|
1. Native ConfigKit acquisition, resolution, and dynamic value binding.
|
||||||
|
2. JSON Schema validation of the completed result.
|
||||||
|
3. Schema-specific semantic validation, such as glossary entry-ID uniqueness.
|
||||||
|
|
||||||
|
JSON Schema success alone does not establish ConfigKit compatibility. JSON
|
||||||
|
Schema cannot express all serialization, number-spelling, or resolution rules.
|
||||||
|
Do not build a recursive substitute for ConfigKit's value checker in JSON
|
||||||
|
Schema or application code. Published semantics must state that native loading
|
||||||
|
is part of full conformance.
|
||||||
|
|
||||||
|
Use one common mapping-root handoff: string-keyed mappings, sequences, and
|
||||||
|
native dynamic scalar values. Do not derive stronger precision guarantees from
|
||||||
|
ConfigKit's private tree retaining original numeric spelling. Typed consumer
|
||||||
|
destinations can impose further task constraints; they do not broaden the
|
||||||
|
shared dynamic-value contract.
|
||||||
|
|
||||||
|
Native resource limits also apply, including the selected baseline's 8 MiB
|
||||||
|
per-source limit. Upstream owns their definitions and enforcement; the schema
|
||||||
|
repository does not duplicate them as schema constraints or local size gates.
|
||||||
|
|
||||||
|
### Aligned contract versions
|
||||||
|
|
||||||
|
Create new version directories, canonical IDs, examples, and catalog records.
|
||||||
|
Leave every published `0.1.0` directory byte-for-byte unchanged.
|
||||||
|
|
||||||
|
- **Glossary:** retain the envelope, general-purpose collection model, nullable
|
||||||
|
aliases/plural, provenance, and per-collection exact ID uniqueness. Replace
|
||||||
|
broader syntax and preservation promises with the common native boundary.
|
||||||
|
- **RPG party:** retain optional players/classes and existing identity rules.
|
||||||
|
Set the class-level maximum to `9223372036854775807`, with minimum `1`.
|
||||||
|
Explain that JSON Schema evaluates integer values after native binding;
|
||||||
|
do not introduce a separate schema-owned numeric spelling parser.
|
||||||
|
- **RPG campaign:** retain domain context and locator semantics. References
|
||||||
|
remain data; schema validation does not fetch them or check installation.
|
||||||
|
|
||||||
|
Keep unknown domain fields allowed. Extension names and values are subject to
|
||||||
|
ConfigKit's native restrictions, including reserved `extends` and source-root
|
||||||
|
`config` controls. Those controls cannot be promised as opaque preserved data.
|
||||||
|
Nested ordinary `config` data follows upstream rules; do not ban that name
|
||||||
|
everywhere. Task instructions remain outside the shared domain contract.
|
||||||
|
|
||||||
|
Replace blanket preservation language with preservation of supported values
|
||||||
|
in the resolved handoff. No trimming, case folding, or domain defaults are
|
||||||
|
introduced by schema validation. Native resolution and numeric binding retain
|
||||||
|
their upstream meaning. Task projections may omit irrelevant fields as before.
|
||||||
|
|
||||||
|
Each new version's semantics must identify its ConfigKit baseline with an
|
||||||
|
immutable upstream reference. Mutable repository-wide guidance must not be able
|
||||||
|
to silently redefine a published contract. No new catalog format or independently
|
||||||
|
versioned serialization-profile system is needed.
|
||||||
|
|
||||||
|
### Native validation harness
|
||||||
|
|
||||||
|
Adopt ConfigKit `v1.4.0` as a pinned dependency. Load each supplied document
|
||||||
|
through `Load[map[string]any]` using `Bytes` for the already-read document, then
|
||||||
|
pass `Result.Config` directly to the existing JSON Schema engine and semantic
|
||||||
|
checks. A public-API probe has established that this path is supported.
|
||||||
|
|
||||||
|
The default validator remains for completed documents. Do not enable import
|
||||||
|
traversal, discovery, overlays, secrets bootstrap, environment overrides, or
|
||||||
|
application defaults/resolvers. Native structural processing still applies;
|
||||||
|
do not implement a pre-parser to disable or reinterpret it. Application
|
||||||
|
composition remains the consuming application's job, and authored partial
|
||||||
|
contributions need not pass complete-document validation.
|
||||||
|
|
||||||
|
Remove the custom domain YAML/JSON decoders, alias traversal, numeric
|
||||||
|
normalization, and arbitrary-precision helpers. Do not retain a fallback for
|
||||||
|
documents rejected by ConfigKit. Keep a simple JSON syntax check for `.json`
|
||||||
|
files if preserving that filename convention; it must not provide an alternate
|
||||||
|
decoding path or bypass native restrictions.
|
||||||
|
|
||||||
|
Change CLI selection from `-schema NAME@VERSION` to `-schema NAME`, selecting
|
||||||
|
that schema's highest SemVer version in the chosen local distribution's catalog.
|
||||||
|
Report the exact selected version. Do not offer historical-version selection or
|
||||||
|
fetch a newer distribution automatically. A development checkout may contain
|
||||||
|
unpublished candidates; a published snapshot selects its own most current version.
|
||||||
|
Retain offline schema registration and exact referenced dependency resolution,
|
||||||
|
maintained JSON Schema validation, and exact glossary ID checks.
|
||||||
|
Do not coerce, default, or mutate the native result during validation. Keep
|
||||||
|
schema resource/catalog JSON decoding separate from operator-domain loading;
|
||||||
|
JSON Schema files themselves are not ConfigKit configuration documents.
|
||||||
|
Resource decoding preserves exact numeric schema constraints independently of
|
||||||
|
ConfigKit's native domain-number binding.
|
||||||
|
|
||||||
|
Preserve useful filename and schema-selection context around native errors.
|
||||||
|
Distinguish native load failures from structural and semantic failures without
|
||||||
|
reconstructing parser diagnostics or promising the previous decoder's positions
|
||||||
|
and wording. Retain the CLI's existing overall success/failure convention.
|
||||||
|
|
||||||
|
Remove the direct YAML dependency if it is no longer used; ConfigKit may retain
|
||||||
|
it transitively. Update module metadata and attribution for the actual dependency
|
||||||
|
set. The harness stays internal; no shared Go SDK or alternate consumer loader
|
||||||
|
is introduced.
|
||||||
|
|
||||||
|
### Documentation and maintained examples
|
||||||
|
|
||||||
|
Update the README, validation guide, development guide, compatibility guidance,
|
||||||
|
and new versioned semantics together. Identify the native loading baseline and
|
||||||
|
explain the distinction between structural validity and full conformance.
|
||||||
|
Update compatibility policy so document generations follow schema major versions:
|
||||||
|
pre-1.0 and 1.x schemas use `.v1`; `.v2` begins at schema `2.0.0`. Pre-1.0
|
||||||
|
contract changes do not require marker changes. Update CLI guidance to use
|
||||||
|
schema names and explain local most-current selection. Consumer pinning to exact
|
||||||
|
published schema versions remains independent of this developer-tool behavior.
|
||||||
|
|
||||||
|
Document supported YAML authoring with short examples and upstream links:
|
||||||
|
quote ambiguous string values, use supported numeric syntax, and avoid aliases
|
||||||
|
and explicit tags. Explain native numeric limits, reserved controls, and JSON
|
||||||
|
limitations without reproducing ConfigKit's entire manual. Do not recommend
|
||||||
|
JSON as a universal escape from ConfigKit restrictions.
|
||||||
|
|
||||||
|
Keep historical inventory, origins, release notes, and published contracts
|
||||||
|
accurate to their original releases. Existing semantic documents link to the
|
||||||
|
mutable validation guide: preserve a clear pointer there to the original
|
||||||
|
`2026.11.0` guide and tool, rather than retrospectively assigning old contracts
|
||||||
|
the new boundary.
|
||||||
|
|
||||||
|
New examples remain synthetic, with glossary examples covering non-RPG domains.
|
||||||
|
Update current fixtures that rely on aliases or exact arbitrary precision.
|
||||||
|
Retain useful historical fixtures as historical evidence, not expectations for
|
||||||
|
the new decoder. Consumer migration notes should identify the new exact versions,
|
||||||
|
retained `.v1` markers, affected authoring forms, and the absence of compatibility
|
||||||
|
shims.
|
||||||
|
|
||||||
|
### Verification and downstream handoff
|
||||||
|
|
||||||
|
Use focused public-API tests for the integration boundary, not a copy of
|
||||||
|
ConfigKit's parser suite:
|
||||||
|
|
||||||
|
- All three new contracts' examples validate through native loading, structural
|
||||||
|
validation, and applicable semantic checks.
|
||||||
|
- Adding a schema to the catalog brings its examples into the ordinary native
|
||||||
|
validation checks without schema-name-specific test wiring. Missing required
|
||||||
|
example coverage or an incompatible maintained example fails the suite.
|
||||||
|
- Selection uses SemVer ordering rather than lexical or catalog order, reports
|
||||||
|
the selected version, and never falls back to an older definition based on
|
||||||
|
document contents. Historical CLI version selection is no longer supported.
|
||||||
|
- Required fields, unknown supported extensions, omitted/null/empty distinctions,
|
||||||
|
and glossary ID uniqueness retain their intended domain behavior.
|
||||||
|
- Representative unsupported syntax, duplicate/non-string keys, integer
|
||||||
|
overflow, and exponent overflow fail through ConfigKit.
|
||||||
|
- Numeric tests assert native handoff behavior rather than exact authored decimal
|
||||||
|
precision. Party levels test the positive bound, maximum, and failures.
|
||||||
|
- Reserved controls follow native behavior. Completed results are validated;
|
||||||
|
directives are not silently treated as preserved extension data.
|
||||||
|
- Supported YAML and JSON representations produce equivalent domain values;
|
||||||
|
unsupported JSON forms have no alternate success path.
|
||||||
|
- Validation remains offline, selected schema references resolve from bundled
|
||||||
|
files, and neither schema selection nor campaign locators trigger network access.
|
||||||
|
- Published directories and existing catalog records remain unchanged. The
|
||||||
|
unpacked distribution retains everything needed for its supported validator.
|
||||||
|
|
||||||
|
Run `go test ./...` and `go vet ./...`, then the existing archive checks at
|
||||||
|
release preparation. Reuse the current release process and publication guards;
|
||||||
|
this roadmap does not authorize publishing.
|
||||||
|
|
||||||
|
After the aligned versions are published, provide their exact schema versions,
|
||||||
|
document markers, source CalVer snapshot, and ConfigKit baseline to Narratio,
|
||||||
|
Notarius, Audita, and the reference catalog. Update their adoption plans to
|
||||||
|
remove broader-profile obligations and custom compatibility work. Those
|
||||||
|
repository changes remain separately scoped.
|
||||||
|
|
||||||
|
## Recorded decisions
|
||||||
|
|
||||||
|
### Versions and document generations
|
||||||
|
|
||||||
|
Release the aligned schemas as `0.2.0`, retaining `maximumdirect.glossary.v1`,
|
||||||
|
`maximumdirect.rpg.party.v1`, and `maximumdirect.rpg.campaign.v1`. Document
|
||||||
|
markers remain `.v1` throughout pre-1.0 and 1.x development; they advance to
|
||||||
|
`.v2` when the corresponding schema reaches `2.0.0`. Update the current
|
||||||
|
compatibility policy accordingly. Published version directories stay immutable.
|
||||||
|
Select the distribution's CalVer at release preparation.
|
||||||
|
|
||||||
|
### Most-current validation
|
||||||
|
|
||||||
|
The validator always uses the most current version of the requested schema in
|
||||||
|
the selected local distribution. It does not provide historical validation modes
|
||||||
|
or multiple decoding implementations. Retain published definitions and catalog
|
||||||
|
records for consumers that pin them. Historical validation, when needed, uses
|
||||||
|
the historical distribution's tool; it is outside the current validator's scope.
|
||||||
|
|
||||||
|
## Open decisions
|
||||||
|
|
||||||
|
None.
|
||||||
337
docs/roadmap/implementation.md
Normal file
337
docs/roadmap/implementation.md
Normal file
@@ -0,0 +1,337 @@
|
|||||||
|
# ConfigKit alignment implementation plan
|
||||||
|
|
||||||
|
## Scope and execution
|
||||||
|
|
||||||
|
Implement [ConfigKit alignment](configkit-alignment.md) in this repository.
|
||||||
|
Audience: a Luna coding agent executing one numbered stage per prompt, in order.
|
||||||
|
This is one end-to-end sprint. Intermediate stages may leave old tests or callers
|
||||||
|
temporarily broken; completion requires the entire final system to pass. Avoid
|
||||||
|
temporary compatibility wrappers or duplicate loaders merely to keep each commit
|
||||||
|
green. Commit focused completed work with short, plain English messages and record
|
||||||
|
actual validation, including intermediate limitations.
|
||||||
|
|
||||||
|
Start with `AGENTS.md` and `docs/development.md`. Read the affected contract and
|
||||||
|
existing tests before changing them. The feature roadmap owns scope and policy;
|
||||||
|
this document owns implementation steps. Do not adopt Narratio-specific policies
|
||||||
|
or application machinery into the schema repository.
|
||||||
|
|
||||||
|
Baseline: schemas commit `09db04d` on top of published distribution `2026.11.0`
|
||||||
|
at `1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`. ConfigKit is
|
||||||
|
`go.maximumdirect.net/configkit v1.4.0`, upstream commit
|
||||||
|
`4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3`. Its pinned
|
||||||
|
[contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md)
|
||||||
|
and [consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md)
|
||||||
|
own native behavior. Recheck the working tree and baseline before starting.
|
||||||
|
|
||||||
|
The settled target is:
|
||||||
|
|
||||||
|
- All three new schema versions are `0.2.0`; document markers retain `.v1`.
|
||||||
|
Pre-1.0 and 1.x versions use `.v1`; major 2 begins `.v2`.
|
||||||
|
- Domain loading uses ConfigKit's native mapping-root handoff. Schema-resource
|
||||||
|
and catalog JSON have a separate standard JSON decoding path.
|
||||||
|
- `-schema NAME` chooses the highest SemVer in the selected local catalog and
|
||||||
|
reports the exact version. No historical selection or fallback is provided.
|
||||||
|
- Every published definition stays inventoried and compiles offline. Native
|
||||||
|
example checks apply to the most current version of every schema name.
|
||||||
|
- Publication, hosting changes, consumer migrations, upstream library changes,
|
||||||
|
and ReleaseKit adoption are outside the sprint. Make no tag or push.
|
||||||
|
|
||||||
|
Preserve `glossary/v0.1.0/`, `rpg/party/v0.1.0/`, and
|
||||||
|
`rpg/campaign/v0.1.0/` byte-for-byte, including examples and semantic documents.
|
||||||
|
Preserve their existing catalog records, original release note, license grants,
|
||||||
|
and historical source snapshots. Select a future CalVer only during a separately
|
||||||
|
requested release; leave `VERSION` and the published release note unchanged here.
|
||||||
|
|
||||||
|
## Execution status
|
||||||
|
|
||||||
|
- Stage 1 complete in `ac21977`: resources use standard JSON decoding with exact
|
||||||
|
numeric constraints. The full existing suite passed.
|
||||||
|
- Stage 2 complete in `dbc2697`: native ConfigKit loading replaces the
|
||||||
|
custom domain decoders. Focused native-handoff/resource tests and `go build
|
||||||
|
./...` passed. Historical decoder tests still require the Stage 5 migration;
|
||||||
|
repository-wide test success is not claimed for this intermediate state.
|
||||||
|
- Stage 3 complete in `24cfdd7`: all three `0.2.0` candidates retain `.v1`
|
||||||
|
markers and pin native loading semantics. All six example documents passed
|
||||||
|
through the CLI; focused native/resource/class-level tests passed, including
|
||||||
|
the exact int64 maximum and the native rounding boundary. Published directory
|
||||||
|
and release-metadata comparisons against `2026.11.0` passed.
|
||||||
|
- Stage 4 complete in `bb88ca1`: current version selection uses maintained
|
||||||
|
SemVer comparison and CLI schema names, with exact selected versions reported.
|
||||||
|
Focused ordering/selection/CLI checks passed.
|
||||||
|
- Stage 5 complete in `d479df5`: full tests and vet pass after migrating
|
||||||
|
fixtures to native binding. Automatic current-example discovery also covers
|
||||||
|
an added synthetic schema name and rejects absent, empty, or invalid examples.
|
||||||
|
Broad-profile fixtures are retained separately as historical evidence.
|
||||||
|
- Stage 6 complete in `83fc228`: current documentation describes native loading,
|
||||||
|
local most-current selection, schema-major marker rules, and historical tool
|
||||||
|
support. Attribution and applicable license texts cover the actual runtime
|
||||||
|
dependency set. Full tests and vet passed.
|
||||||
|
- Stage 7 complete: implementation candidate `83fc228` passed full tests, vet,
|
||||||
|
repeated race/shuffle checks, authoritative published-directory verification,
|
||||||
|
and `GOTOOLCHAIN=go1.27.4 sh scripts/check.sh`, including its test pass from
|
||||||
|
an unpacked committed archive. This completion record is documentation-only;
|
||||||
|
the archive check is repeated on the final committed handoff containing it.
|
||||||
|
|
||||||
|
Consumer handoff: glossary, RPG party, and RPG campaign each have an unpublished
|
||||||
|
`0.2.0` candidate, retain their `.v1` document markers, and use ConfigKit `v1.4.0`
|
||||||
|
at the pinned revision above. Their future source CalVer is intentionally unset.
|
||||||
|
Consumers can plan against the candidate, but published adoption baselines wait
|
||||||
|
for a separately authorized release. Historical full validation uses the tool
|
||||||
|
from `2026.11.0`; this tool always applies its pinned native loader.
|
||||||
|
|
||||||
|
Published contracts, old catalog records, release metadata, license grants, and
|
||||||
|
origin snapshots remain unchanged. Domain-loader code and the old broad-profile
|
||||||
|
tests were removed rather than retained as compatibility implementations. Native
|
||||||
|
source limits, numeric rounding, and JSON serialization restrictions remain
|
||||||
|
intentional upstream boundaries. No additional implementation blocker remains.
|
||||||
|
No upstream application changes, tag, push, live-host verification, or CI polling
|
||||||
|
have been performed. Both implementation and planning changes are committed.
|
||||||
|
|
||||||
|
## Stage 1 — Separate resource JSON from domain decoding
|
||||||
|
|
||||||
|
Read `internal/validation/{validate,decode}.go`, `catalog_test.go`, and
|
||||||
|
`TestDistributionAndOfflineResolution` in `validation_test.go`.
|
||||||
|
|
||||||
|
1. Remove schema-resource and catalog dependence on the custom domain `Decode`
|
||||||
|
path. Use the standard JSON decoder for these maintained JSON files.
|
||||||
|
2. Decode schema resources into generic JSON values using
|
||||||
|
`json.Decoder.UseNumber`. Retain the exact number `9223372036854775807` in
|
||||||
|
schema constraints. Do not convert resource numbers through `float64`.
|
||||||
|
Catalog records can continue decoding into their existing typed structures.
|
||||||
|
3. Retain JSON syntax/completeness checks, inventory consistency checks, Draft
|
||||||
|
2020-12 meta-validation, local registration before compilation, and denial of
|
||||||
|
unresolved network resources. Do not apply ConfigKit source controls or its
|
||||||
|
size/value limits to schema resources.
|
||||||
|
4. Use the standard decoder directly or a small internal helper. Do not preserve
|
||||||
|
the old token walker as a second resource parser or introduce a generic codec
|
||||||
|
framework. This work does not establish new resource error-wording contracts.
|
||||||
|
|
||||||
|
Acceptance: an in-memory schema fixture with the exact maximum compiles; valid
|
||||||
|
and above-bound values are distinguished without rounding the schema constraint.
|
||||||
|
Catalog failures, missing references, and bundled cross-schema references retain
|
||||||
|
their protection. No schema resource is passed through ConfigKit.
|
||||||
|
|
||||||
|
## Stage 2 — Adopt native ConfigKit domain loading
|
||||||
|
|
||||||
|
Read the pinned ConfigKit guidance above, `cmd/validate/main.go`, the decoder, and
|
||||||
|
the decoding/CLI tests. Use upstream public APIs, not private implementation types.
|
||||||
|
|
||||||
|
1. Add ConfigKit `v1.4.0`. Replace domain decoding with one small operation that
|
||||||
|
calls `configkit.Load[map[string]any](configkit.Bytes(label, data))`. Use a
|
||||||
|
useful non-secret document label, normally the caller's filename.
|
||||||
|
2. Pass `Result.Config` directly to JSON Schema and existing domain semantic
|
||||||
|
checks. Do not marshal/unmarshal, reconstruct a mapping, repair scalars,
|
||||||
|
normalize numbers, populate defaults, or mutate the native result.
|
||||||
|
3. Use ordinary loading without import traversal, discovery, overlays, startup
|
||||||
|
bootstrap, environment overrides, or application defaults/resolvers. Preserve
|
||||||
|
native structural handling of `extends` and source-root `config` even when
|
||||||
|
imports are disabled. No pre-parser disables these features or treats them
|
||||||
|
as opaque domain extensions. Nested ordinary `config` remains permitted as
|
||||||
|
upstream supports it.
|
||||||
|
4. Delete custom domain YAML/JSON token/node walkers, alias expansion, numeric
|
||||||
|
spelling normalization, arbitrary-precision helpers, and tests whose only
|
||||||
|
remaining purpose would be protecting those implementations. Retain the small
|
||||||
|
JSON Pointer escaping helper used by semantic diagnostics in its actual owner.
|
||||||
|
5. Keep the existing `.json` filename syntax check. It precedes the same native
|
||||||
|
load; it is not an alternate decoder. Wrap native errors with load-phase and
|
||||||
|
document context without reconstructing diagnostics. Preserve structural and
|
||||||
|
semantic failure categories after successful acquisition.
|
||||||
|
6. Tidy module metadata. Remove direct YAML imports/dependency when unused;
|
||||||
|
ConfigKit may retain YAML transitively. Keep the Go minimum and JSON Schema
|
||||||
|
dependency unchanged unless a concrete compilation requirement demands it.
|
||||||
|
|
||||||
|
Acceptance: focused public-API tests cover a supported mapping, null/empty
|
||||||
|
values, literal Unicode, native int64/float64 binding, and a native load failure.
|
||||||
|
Native limits apply, including the baseline's 8 MiB source limit; do not copy
|
||||||
|
that limit into local constants, add truncation, or introduce another size gate.
|
||||||
|
The old decoder is gone rather than hidden behind a fallback.
|
||||||
|
|
||||||
|
## Stage 3 — Add the aligned immutable contract candidates
|
||||||
|
|
||||||
|
Read all three `0.1.0` schemas/semantics and `catalog.json`. Create:
|
||||||
|
|
||||||
|
| New root | Marker |
|
||||||
|
| --- | --- |
|
||||||
|
| `glossary/v0.2.0/` | `maximumdirect.glossary.v1` |
|
||||||
|
| `rpg/party/v0.2.0/` | `maximumdirect.rpg.party.v1` |
|
||||||
|
| `rpg/campaign/v0.2.0/` | `maximumdirect.rpg.campaign.v1` |
|
||||||
|
|
||||||
|
Each root contains `schema.json`, `semantics.md`, and representative `examples/`.
|
||||||
|
Set `$id` to `https://schemas.maximumdirect.net/` plus the new schema path.
|
||||||
|
Add catalog records without replacing old records or changing catalog format.
|
||||||
|
Correct cross-document example locators to the new adjacent versioned inputs.
|
||||||
|
|
||||||
|
Preserve domain fields, extension acceptance, omissions/null/empty distinctions,
|
||||||
|
and per-collection exact glossary ID uniqueness. `ruleset` remains an extension,
|
||||||
|
not a defined glossary provenance field. Party's defined `level` gains maximum
|
||||||
|
`9223372036854775807`, retaining minimum `1` and JSON Schema integer semantics
|
||||||
|
after native binding. Do not require integer lexical spelling beyond ConfigKit's
|
||||||
|
own rules or recover precision lost by its dynamic float binding.
|
||||||
|
|
||||||
|
Write each new semantic document with the immutable ConfigKit baseline link and
|
||||||
|
an affirmative definition of the completed native handoff. Preserve supported
|
||||||
|
resolved values; schema validation adds no trimming, case folding, or defaults.
|
||||||
|
Defined fields plus native acquisition jointly establish conformance. State that
|
||||||
|
structural validation alone cannot prove native loading compatibility. Delegate
|
||||||
|
syntax and resource limits upstream, including the per-source limit. Keep the
|
||||||
|
glossary domain-neutral, with both weather and sports examples.
|
||||||
|
|
||||||
|
Acceptance: all new schemas compile offline; representative new examples load
|
||||||
|
through ConfigKit and pass structure/semantics. Party tests cover zero, negative,
|
||||||
|
fractional, maximum int64, and above-maximum levels at the applicable failure
|
||||||
|
boundary. Published directories and old catalog records remain unchanged.
|
||||||
|
|
||||||
|
## Stage 4 — Select the most current local version by schema name
|
||||||
|
|
||||||
|
Read `Set.Select`, catalog loading, and the CLI and selection tests. Replace
|
||||||
|
name/version CLI selection rather than adding another mode.
|
||||||
|
|
||||||
|
1. Keep exact compiled schemas indexed by canonical identity for references.
|
||||||
|
Build one reusable current-record selection per schema name from the catalog;
|
||||||
|
both CLI selection and example discovery use this result.
|
||||||
|
2. Compare full SemVer with `golang.org/x/mod/semver`, pinning `golang.org/x/mod`
|
||||||
|
at `v0.43.0` if it is not already selected. Prefix versions with `v` for the
|
||||||
|
library API. Do not compare versions lexically or build a comparator/parser.
|
||||||
|
Include prereleases in ordinary SemVer ordering; a stable version outranks
|
||||||
|
its prereleases. Build metadata does not affect precedence. For equal
|
||||||
|
precedence, retain the first catalog record as an internal deterministic tie
|
||||||
|
handling choice, not a new public ordering guarantee or rejection rule.
|
||||||
|
3. Change CLI syntax to `-schema NAME`, retaining `-root`. Reject missing/unknown
|
||||||
|
names, including the removed `NAME@VERSION` syntax, as selection/usage errors.
|
||||||
|
All supplied documents use the chosen definition. Do not guess from markers,
|
||||||
|
retry an older schema, add version flags, or download a newer catalog.
|
||||||
|
4. Report exact selected name/version and marker on success. Retain exit 0 for
|
||||||
|
success, 1 for document read/load/structure/semantic failures, and 2 for
|
||||||
|
usage/selection/unusable-distribution errors. Continue checking later files
|
||||||
|
after a document fails. Error wording/order is not otherwise frozen.
|
||||||
|
|
||||||
|
Acceptance: tests distinguish `0.9.0` from `0.10.0`, stable from prerelease, and
|
||||||
|
catalog ordering from precedence. Temporary definitions sharing a marker prove
|
||||||
|
the selected schema is actually applied and failures never cause fallback.
|
||||||
|
Missing name, unknown name, removed exact-version syntax, marker mismatch,
|
||||||
|
mixed valid/invalid documents, and an unpacked `-root` are covered.
|
||||||
|
|
||||||
|
## Stage 5 — Align catalog-driven verification and historical evidence
|
||||||
|
|
||||||
|
Read `internal/validation/*_test.go`, `cmd/validate/main_test.go`,
|
||||||
|
`tests/{valid,invalid}/`, and publication history tests.
|
||||||
|
|
||||||
|
1. Compile every inventoried schema offline, including historical versions and
|
||||||
|
exact referenced dependencies. For native examples, iterate the current
|
||||||
|
record per schema name from Stage 4, require its examples directory to be
|
||||||
|
nonempty, and validate every maintained YAML/JSON document there through
|
||||||
|
ConfigKit, that exact selected schema, and applicable semantic checks.
|
||||||
|
2. Add a synthetic schema name in a temporary catalog and prove its examples
|
||||||
|
are discovered automatically. Missing examples and an invalid maintained
|
||||||
|
example fail verification. Do not maintain a hard-coded current-name list,
|
||||||
|
generic semantic-plugin interface, or compatibility prover.
|
||||||
|
3. Keep useful broad-profile fixtures as clearly located/labeled historical
|
||||||
|
evidence outside current fixture traversal. Their original decoding behavior
|
||||||
|
belongs to the `2026.11.0` tool. Do not run historical native-example checks,
|
||||||
|
restore the old decoder, or change historical published examples to pass.
|
||||||
|
4. Retain domain regression coverage under native binding: required/known fields,
|
||||||
|
supported extensions at every object layer, omissions/null/empty values,
|
||||||
|
Unicode, duplicate glossary IDs within a collection, cross-collection ID reuse,
|
||||||
|
and no mutation during structural/semantic validation.
|
||||||
|
5. Replace exact-arbitrary-precision expectations with native int64 and float64
|
||||||
|
expectations. Cover integer overflow, exponent overflow, representative
|
||||||
|
unsupported scalar syntax/tags/aliases, duplicate/non-string keys, and the
|
||||||
|
JSON surrogate-escape limitation versus supported literal Unicode. Assert
|
||||||
|
failure phase/useful context rather than copying native diagnostic wording.
|
||||||
|
Use a small representative set, not ConfigKit's parser test inventory.
|
||||||
|
6. Prove native resolution is authoritative: `extends: null` is consumed, a
|
||||||
|
supported sibling inheritance resolves with imports disabled, invalid
|
||||||
|
source-root control data fails, and nested ordinary `config` data survives.
|
||||||
|
Validate the completed result without imposing a second directive policy.
|
||||||
|
7. Retain an equivalent supported YAML/JSON example pair. Verify native
|
||||||
|
acquisition and local references do not contact providers or fetch campaign
|
||||||
|
locators. Keep existing local static-path/byte checks and publication tests
|
||||||
|
detecting changed/removed published directories while allowing new versions.
|
||||||
|
|
||||||
|
Acceptance: the ordinary suite covers new schemas discovered through catalog
|
||||||
|
data, old resources still compile, and historical examples impose no new-tool
|
||||||
|
decoding contract. Tests remain deterministic and use local temporary fixtures
|
||||||
|
or loopback HTTP only. No paid calls, production URLs, or installed consumers
|
||||||
|
are required.
|
||||||
|
|
||||||
|
## Stage 6 — Update canonical guidance and attribution
|
||||||
|
|
||||||
|
Update `README.md`, `docs/{validation,development,compatibility,catalog}.md`,
|
||||||
|
`AGENTS.md`, and affected current navigation/examples. Keep published versioned
|
||||||
|
documents and the `2026.11.0` release note unchanged.
|
||||||
|
|
||||||
|
- Explain `0.2.0` candidates and the changed acquisition contract with retained
|
||||||
|
`.v1` markers. Replace the previous pre-stable marker-change policy with the
|
||||||
|
agreed schema-major rule. Published directory immutability remains unchanged.
|
||||||
|
- Document `-schema NAME` as local most-current selection, with exact version
|
||||||
|
reporting. A development catalog can select unpublished candidates. Consumer
|
||||||
|
pinning of exact schema versions and source CalVer snapshots is independent
|
||||||
|
of this developer CLI. Neither mode fetches newer inputs automatically.
|
||||||
|
- State that this tool always uses its pinned ConfigKit boundary. Historical
|
||||||
|
full conformance uses the historical distribution's tool; choosing an older
|
||||||
|
root with a newer binary does not restore a historical decoder.
|
||||||
|
- Replace the independent syntax manual with a concise boundary description,
|
||||||
|
short authoring advice, and pinned upstream links. Include native source limits
|
||||||
|
and numeric/JSON limitations as upstream behavior, not new local enforcement.
|
||||||
|
Put an obvious immutable link to the original `2026.11.0` validation guide/tool
|
||||||
|
in the mutable guide for readers arriving from historical semantic documents.
|
||||||
|
- Add the standing authoring review in development guidance and link from
|
||||||
|
`AGENTS.md`: field types, numeric ranges/precision, reserved controls,
|
||||||
|
extension values, representative examples, and native boundary fixtures.
|
||||||
|
New schemas and ConfigKit upgrades receive the same review. Tests are useful
|
||||||
|
evidence rather than proof of every accepted document's compatibility.
|
||||||
|
- Update attribution for actual incorporated dependencies, including ConfigKit,
|
||||||
|
the SemVer package, and applicable transitive material. Verify actual selected
|
||||||
|
versions, terms, and commit links. Preserve original CC0 scope and the glossary
|
||||||
|
origin snapshot. A dependency's upstream tool declaration is not adoption of
|
||||||
|
ReleaseKit into this repository's release workflow.
|
||||||
|
|
||||||
|
Acceptance: current docs agree with actual CLI and contracts; upstream manuals
|
||||||
|
remain canonical. No active guidance promises the old decoder or redefines old
|
||||||
|
contracts. No future release date, tag, distribution version, or publication is
|
||||||
|
claimed by this sprint.
|
||||||
|
|
||||||
|
## Stage 7 — Verify the complete committed candidate and hand off
|
||||||
|
|
||||||
|
Review the final scope diff against the feature roadmap. Confirm there is one
|
||||||
|
native domain loader, a separate standard resource decoder preserving exact
|
||||||
|
constraints, no hidden historical CLI mode, no duplicate parsing/repair, and no
|
||||||
|
application changes. Confirm all three `0.2.0` roots have pinned-baseline semantics,
|
||||||
|
the correct IDs, unchanged `.v1` markers, and suitable examples.
|
||||||
|
|
||||||
|
Prepare dependencies, then run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
GOTOOLCHAIN=go1.27.4 go test ./...
|
||||||
|
GOTOOLCHAIN=go1.27.4 go vet ./...
|
||||||
|
```
|
||||||
|
|
||||||
|
Compare every previously published contract directory and old catalog record
|
||||||
|
against `2026.11.0`; use the existing publication check for that tag or the normal
|
||||||
|
authoritative-remote check after fetching its tags. History checks remain separate
|
||||||
|
from offline distribution checks. Do not change the publication mechanism.
|
||||||
|
|
||||||
|
Commit the final intended schema candidate, then run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
GOTOOLCHAIN=go1.27.4 sh scripts/check.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
The existing script tests the checkout, runs vet, and tests an unpacked committed
|
||||||
|
source archive. Its extracted-tree tests must work without the original checkout
|
||||||
|
or Git metadata in that tree. CI continues using this same command; update its
|
||||||
|
configuration only if necessary for the actual dependency/setup changes. Do not
|
||||||
|
add CI polling or external-host gates. If candidate content changes, commit and
|
||||||
|
revalidate the affected final candidate rather than citing an earlier revision.
|
||||||
|
|
||||||
|
Record stage completion, candidate hash, selected schema/ConfigKit versions,
|
||||||
|
checks actually run, historical support guidance, and any remaining limitations
|
||||||
|
in this plan. Leave committed clean worktrees. Summarize the exact consumer
|
||||||
|
handoff information available now; the future published CalVer is intentionally
|
||||||
|
unset. Stop before tagging, pushing, or changing consumer repositories.
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
None. The feature decisions are settled; remaining details above are scoped
|
||||||
|
implementation choices. A later release task selects the actual CalVer and
|
||||||
|
publishes, and later consumer roadmaps define application adoption.
|
||||||
@@ -1,111 +1,82 @@
|
|||||||
# Validation
|
# Validation
|
||||||
|
|
||||||
Validate a completed domain document after the composing application has resolved
|
## Current and historical boundaries
|
||||||
imports, inheritance, and layering. ConfigKit owns those operations; this
|
|
||||||
repository defines the handoff format. Partial authoring contributions may use
|
Current tooling uses ConfigKit v1.4.0 for every domain document. The
|
||||||
schema definitions for editor assistance without conforming to a complete root.
|
[pinned input contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md)
|
||||||
|
owns syntax, resolution, resource limits, and native values; its
|
||||||
|
[consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md)
|
||||||
|
owns library use.
|
||||||
|
|
||||||
|
Published `0.1.0` contracts used a broader decoding profile. Their complete
|
||||||
|
historical validation requires the
|
||||||
|
[2026.11.0 guide](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/docs/validation.md)
|
||||||
|
and [historical tool](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/cmd/validate/main.go).
|
||||||
|
Choosing an older root with this newer binary does not restore a historical
|
||||||
|
decoder. Historical definitions remain bundled for offline structural use;
|
||||||
|
current native example checks target the most current local version of each name.
|
||||||
|
|
||||||
## Command
|
## Command
|
||||||
|
|
||||||
With Go 1.27 or later, run from the selected schema-set checkout or unpacked
|
With Go 1.27 or later, prepare pinned dependencies and validate:
|
||||||
source archive:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
go mod download
|
go mod download
|
||||||
go run ./cmd/validate -schema rpg/party@0.1.0 rpg/party/v0.1.0/examples/party.yml
|
go run ./cmd/validate -schema rpg/party rpg/party/v0.2.0/examples/party.yml
|
||||||
go run ./cmd/validate -schema glossary@0.1.0 glossary/v0.1.0/examples/weather.yml
|
go run ./cmd/validate -schema glossary glossary/v0.2.0/examples/weather.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
Dependencies are pinned in `go.mod` and `go.sum`. Once prepared, validation is
|
`-schema NAME` selects that name's highest SemVer in the local
|
||||||
offline. A built tool can select another unpacked distribution:
|
[catalog](catalog.md). It reports the exact selected version and document marker.
|
||||||
|
There is no historical version flag or `NAME@VERSION` syntax. A checkout may
|
||||||
|
select unpublished candidates; an immutable distribution has its own catalog.
|
||||||
|
Selection never downloads a new catalog or retries older schemas after failure.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
go build -o /tmp/schemas-validate ./cmd/validate
|
go build -o /tmp/schemas-validate ./cmd/validate
|
||||||
/tmp/schemas-validate -root /path/to/distribution -schema glossary@0.1.0 /path/to/completed-glossary.yml
|
/tmp/schemas-validate -root /path/to/distribution -schema glossary /path/to/glossary.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
Select exactly `name@version` from [catalog.json](../catalog.json). All supplied
|
Flags precede filenames. Every document in an invocation uses the selected schema;
|
||||||
documents are validated against that definition, including their document marker.
|
later files are still checked after an earlier failure. Exit 0 means success,
|
||||||
Separate invocations select different schemas. Success reports the selected version.
|
1 means document read/load/structural/semantic failure, and 2 means usage,
|
||||||
Flags precede filenames. All files are checked even if an earlier file fails.
|
selection, or distribution failure. Native failures retain library diagnostics
|
||||||
Exit 0 means all documents passed; 1 means a document could not be read or
|
with filename context; schema and semantic failures identify relevant locations.
|
||||||
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.
|
|
||||||
Semantic duplicate-ID errors identify the collection and entry index.
|
|
||||||
|
|
||||||
The harness uses Go's standard JSON decoder for JSON syntax, including Unicode
|
## Native domain handoff
|
||||||
surrogate-pair escapes, and [go-yaml v4](https://github.com/yaml/go-yaml/tree/v4.0.0)
|
|
||||||
otherwise. Both paths reject duplicate keys and preserve number precision. It uses
|
|
||||||
[jsonschema v6](https://github.com/santhosh-tekuri/jsonschema/tree/v6.0.3)
|
|
||||||
for Draft 2020-12 validation. It performs glossary ID uniqueness after structural
|
|
||||||
validation. It does not resolve domain references, check resource installation,
|
|
||||||
infer consumer support, populate defaults, or rewrite files.
|
|
||||||
|
|
||||||
## YAML decoding profile
|
Supply a completed mapping after the composing application has resolved its
|
||||||
|
inputs. The harness calls native `Load[map[string]any]` on `Bytes`, then passes
|
||||||
|
`Result.Config` directly to structural and semantic validation. It enables no
|
||||||
|
imports, discovery, overlays, startup bootstrap, overrides, or application defaults.
|
||||||
|
Native structural processing still applies: `extends` is a directive and
|
||||||
|
source-root `config` is a control namespace. Nested ordinary `config` data
|
||||||
|
follows upstream behavior.
|
||||||
|
|
||||||
Use one document containing string-keyed mappings, sequences, strings, finite
|
Quote ambiguous strings such as `"yes"`, use supported decimal numeric syntax,
|
||||||
numbers, booleans, and null. JSON is an equivalent serialization; `.json` files
|
and avoid explicit tags, anchors, and aliases. Dynamic integer syntax binds to
|
||||||
must use JSON syntax. The same duplicate-key and semantic rules apply to both.
|
int64; fractional/exponent syntax binds to finite float64 and may round. Native
|
||||||
|
source limits apply, including the baseline's 8 MiB per source. This repository
|
||||||
|
does not duplicate those checks or repair rejected inputs. Both YAML and JSON
|
||||||
|
use the same native loader; JSON is not an escape from native restrictions.
|
||||||
|
Files ending in `.json` additionally require JSON syntax.
|
||||||
|
|
||||||
- Duplicate mapping keys are errors at every level. Keys compare as strings.
|
Full conformance includes native acquisition, JSON Schema structure, and applicable
|
||||||
- Mapping keys must resolve to strings; quote numeric or boolean-looking keys
|
semantic rules. The harness checks exact glossary entry-ID uniqueness within
|
||||||
when they are intended to be names. Mapping order carries no domain meaning.
|
each collection. It does not fetch campaign locators, infer consumer support,
|
||||||
- `true` and `false` (including YAML case variants) are booleans. `yes`, `no`,
|
populate domain defaults, or mutate the loaded configuration. Extensions preserve
|
||||||
`on`, and `off` remain strings; a schema never coerces them into booleans.
|
supported resolved values; task projections can omit irrelevant data.
|
||||||
- Date-like and timestamp scalars are strings containing their authored text.
|
|
||||||
Quote ambiguous values when authoring for other YAML tools with different
|
|
||||||
scalar-resolution policies.
|
|
||||||
- `null`, `Null`, `NULL`, `~`, and an empty scalar are null. Quoted forms are
|
|
||||||
strings. Absence, null, and empty containers are distinct.
|
|
||||||
- YAML integer spellings supported by go-yaml include decimal, `0x` hexadecimal,
|
|
||||||
`0o` octal, `0b` binary, legacy leading-zero octal, and separators. Decimal
|
|
||||||
floats may use a sign, exponent, leading dot, trailing dot, or separators.
|
|
||||||
Numeric scalar resolution follows go-yaml, with plain JSON number spellings
|
|
||||||
additionally recognized beyond machine numeric range. The adapter preserves
|
|
||||||
decimal precision as JSON numbers rather than converting through machine
|
|
||||||
floating point. NaN and infinities are errors.
|
|
||||||
Explicitly tagged floats must have valid numeric syntax before normalization;
|
|
||||||
empty values or incomplete forms such as `!!float e3` are errors.
|
|
||||||
- Anchors and aliases are accepted and resolved to values. Cycles are errors.
|
|
||||||
Anchors, aliases, comments, and formatting are serialization details.
|
|
||||||
- Standard mapping, sequence, string, integer, float, boolean, null, and
|
|
||||||
timestamp tags have the representations above. Custom tags, binary values,
|
|
||||||
sets, ordered-map tags, complex keys, and merge keys have no representation
|
|
||||||
in this completed-document profile. Resolve authoring composition before this
|
|
||||||
boundary; a quoted string key `"<<"` remains an ordinary extension key.
|
|
||||||
|
|
||||||
This is an explicit profile, not a promise to accept every YAML feature.
|
## Offline resources and editors
|
||||||
Consumers using other parsers should test the same cases before claiming
|
|
||||||
compatibility. Native library limits remain implementation safeguards, not
|
|
||||||
additional domain constraints.
|
|
||||||
|
|
||||||
## Structural and semantic boundaries
|
Schema resources and catalogs use standard JSON decoding, independently of
|
||||||
|
domain acquisition. Resource numbers remain exact so schema constraints do not
|
||||||
|
round. The maintained JSON Schema engine compiles every bundled schema under its
|
||||||
|
canonical ID, registers dependencies locally, and rejects absent resource loads.
|
||||||
|
Only current versions' examples are checked through native acquisition.
|
||||||
|
|
||||||
All defined fields are validated when present. Objects permit extensions unless
|
Consumers can pin exact schema versions and a published CalVer archive, bundle
|
||||||
a field is itself a named-record mapping, whose values must satisfy that record
|
their dependency closure and semantic documents, and register local files under
|
||||||
schema. For example, every item in `collections` is a collection, not arbitrary
|
canonical IDs. Consumer pinning is independent of this CLI's name selection.
|
||||||
document metadata. Put metadata on the envelope, collection, or entry.
|
Editors can associate documents externally with their selected schema. Structural
|
||||||
|
editor feedback alone does not prove native acquisition or full conformance.
|
||||||
The semantic inventory is in [the initial inventory](inventory.md). The harness
|
|
||||||
checks entry-ID uniqueness within each glossary collection using exact string
|
|
||||||
comparison. Party-ID uniqueness is already covered by duplicate-key rejection.
|
|
||||||
The initial contract defines no cross-document referential-integrity rule.
|
|
||||||
Structural success alone does not prove these semantic rules or that a consumer
|
|
||||||
can use the document for a particular operation.
|
|
||||||
|
|
||||||
## Offline schema use and editors
|
|
||||||
|
|
||||||
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.
|
|
||||||
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.
|
|
||||||
|
|||||||
21
glossary/v0.2.0/examples/glossary.yml
Normal file
21
glossary/v0.2.0/examples/glossary.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
campaign:
|
||||||
|
entries:
|
||||||
|
- id: lighthouse
|
||||||
|
name: Glass Lantern
|
||||||
|
category: place
|
||||||
|
aliases: [The Lantern]
|
||||||
|
description: A fictional lighthouse at the entrance to the bay.
|
||||||
|
spells:
|
||||||
|
provenance:
|
||||||
|
id: lantern-coast-original
|
||||||
|
title: Synthetic campaign spells
|
||||||
|
version: "1"
|
||||||
|
license: CC0-1.0
|
||||||
|
entries:
|
||||||
|
- id: ember-veil
|
||||||
|
name: Ember Veil
|
||||||
|
category: spell
|
||||||
|
aliases: [Veil of Embers]
|
||||||
|
casting_time: one action
|
||||||
16
glossary/v0.2.0/examples/sports.yml
Normal file
16
glossary/v0.2.0/examples/sports.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
clubs:
|
||||||
|
sport: association football
|
||||||
|
entries:
|
||||||
|
- id: harbour
|
||||||
|
name: Harbour Wanderers
|
||||||
|
category: club
|
||||||
|
aliases: []
|
||||||
|
plural: null
|
||||||
|
home_ground: Lantern Park
|
||||||
|
venues:
|
||||||
|
entries:
|
||||||
|
- id: harbour
|
||||||
|
name: Lantern Park
|
||||||
|
category: venue
|
||||||
12
glossary/v0.2.0/examples/weather.json
Normal file
12
glossary/v0.2.0/examples/weather.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"schema_version": "maximumdirect.glossary.v1",
|
||||||
|
"collections": {
|
||||||
|
"measurements": {
|
||||||
|
"unit_system": "metric",
|
||||||
|
"entries": [
|
||||||
|
{"id": "temperature", "name": "Air temperature", "category": "measurement", "aliases": ["Temperature"], "unit": "degree Celsius"},
|
||||||
|
{"id": "precipitation", "name": "Precipitation", "category": "measurement", "aliases": null, "unit": "millimetre"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
glossary/v0.2.0/examples/weather.yml
Normal file
15
glossary/v0.2.0/examples/weather.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
measurements:
|
||||||
|
unit_system: metric
|
||||||
|
entries:
|
||||||
|
- id: temperature
|
||||||
|
name: Air temperature
|
||||||
|
category: measurement
|
||||||
|
aliases: [Temperature]
|
||||||
|
unit: degree Celsius
|
||||||
|
- id: precipitation
|
||||||
|
name: Precipitation
|
||||||
|
category: measurement
|
||||||
|
aliases: null
|
||||||
|
unit: millimetre
|
||||||
51
glossary/v0.2.0/schema.json
Normal file
51
glossary/v0.2.0/schema.json
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json",
|
||||||
|
"title": "MAXIMUMDIRECT Glossary v1",
|
||||||
|
"type": "object",
|
||||||
|
"required": ["schema_version", "collections"],
|
||||||
|
"properties": {
|
||||||
|
"schema_version": {"const": "maximumdirect.glossary.v1"},
|
||||||
|
"collections": {
|
||||||
|
"type": "object",
|
||||||
|
"propertyNames": {"minLength": 1},
|
||||||
|
"additionalProperties": {"$ref": "#/$defs/collection"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$defs": {
|
||||||
|
"text": {"type": "string", "minLength": 1},
|
||||||
|
"aliases": {"type": ["array", "null"], "items": {"$ref": "#/$defs/text"}},
|
||||||
|
"entry": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "name", "category"],
|
||||||
|
"properties": {
|
||||||
|
"id": {"$ref": "#/$defs/text"},
|
||||||
|
"name": {"$ref": "#/$defs/text"},
|
||||||
|
"category": {"$ref": "#/$defs/text"},
|
||||||
|
"description": {"type": "string"},
|
||||||
|
"aliases": {"$ref": "#/$defs/aliases"},
|
||||||
|
"plural": {"type": ["string", "null"], "minLength": 1}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provenance": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {"$ref": "#/$defs/text"},
|
||||||
|
"title": {"$ref": "#/$defs/text"},
|
||||||
|
"version": {"type": "string"},
|
||||||
|
"url": {"type": "string"},
|
||||||
|
"license": {"type": "string"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"partialCollection": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"entries": {"type": "array", "items": {"$ref": "#/$defs/entry"}},
|
||||||
|
"provenance": {"$ref": "#/$defs/provenance"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"collection": {
|
||||||
|
"allOf": [{"$ref": "#/$defs/partialCollection"}, {"required": ["entries"]}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
83
glossary/v0.2.0/semantics.md
Normal file
83
glossary/v0.2.0/semantics.md
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Glossary contract
|
||||||
|
|
||||||
|
## Native loading boundary
|
||||||
|
|
||||||
|
Full conformance includes acquisition through the public mapping-root handoff of
|
||||||
|
[ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md),
|
||||||
|
followed by this schema and its semantic checks. ConfigKit owns syntax, structural
|
||||||
|
controls, numeric binding, and resource limits, including its 8 MiB source limit.
|
||||||
|
Dynamic integers bind as int64 and fractional/exponent values as finite float64;
|
||||||
|
authored decimal precision is not guaranteed. Preserve supported resolved values.
|
||||||
|
`extends` is structural input and source-root `config` is a control namespace;
|
||||||
|
nested ordinary `config` follows upstream rules. Other supported domain extensions
|
||||||
|
remain permitted. Schema validation adds no trimming, case folding, or defaults.
|
||||||
|
Structural validation alone does not prove native loading compatibility. The
|
||||||
|
pinned upstream contract defines this version's boundary independently of later
|
||||||
|
changes to the repository's general guidance.
|
||||||
|
|
||||||
|
Contract: `maximumdirect.glossary.v1`. [Schema](schema.json).
|
||||||
|
The [validation profile](../../docs/validation.md) and [compatibility rules](../../docs/compatibility.md)
|
||||||
|
apply. Start with [campaign vocabulary](examples/glossary.yml),
|
||||||
|
[weather](examples/weather.yml), or [sports](examples/sports.yml).
|
||||||
|
|
||||||
|
| Field | Required | Meaning |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `schema_version` | Yes | Exactly `maximumdirect.glossary.v1`. |
|
||||||
|
| `collections` | Yes | Mapping of nonempty collection names to collections; may be empty. |
|
||||||
|
| `collections.<name>.entries` | Yes | List of entries; may be empty. |
|
||||||
|
| `entries[].id` | Yes | Stable, nonempty identity unique within this collection. |
|
||||||
|
| `entries[].name` | Yes | Nonempty canonical display name. |
|
||||||
|
| `entries[].category` | Yes | Nonempty domain-defined category. |
|
||||||
|
| `entries[].description` | No | Description; an empty string is valid. |
|
||||||
|
| `entries[].aliases` | No | Alternative names for the same entity. May be null, empty, or a list of nonempty strings. |
|
||||||
|
| `entries[].plural` | No | Nonempty plural display form, or null. |
|
||||||
|
| `collections.<name>.provenance` | No | Source metadata object, possibly empty. Optional `id` and `title` are nonempty strings; optional `version`, `url`, and `license` are strings that may be empty. |
|
||||||
|
|
||||||
|
All objects permit extensions. Optional fields accept omission; only `aliases`
|
||||||
|
and `plural` additionally accept null. Supported resolved values are preserved; schema validation adds no trimming,
|
||||||
|
case folding, coercion, or defaults. IDs and names compare exactly. Distinct
|
||||||
|
collections can reuse an ID. Display names, aliases, and categories need not be
|
||||||
|
unique. Lists retain their authored order but establish no precedence or execution
|
||||||
|
order. Collection names and categories are strings chosen by the domain, not a
|
||||||
|
fixed set of D&D labels.
|
||||||
|
|
||||||
|
For example, `spells` entries contain names, aliases, and optionally extended
|
||||||
|
domain information such as `casting_time`. Their collection's provenance can
|
||||||
|
identify a source catalog. Domain-specific metadata can use extension fields.
|
||||||
|
Provenance describes origin and applicability;
|
||||||
|
it is not transcript evidence or a spell rule. If different source contexts
|
||||||
|
matter, use separately named collections with their own provenance. A consumer
|
||||||
|
can derive its recognition input from these entries instead of requiring a second
|
||||||
|
operator-maintained spell list. Embedded vocabulary, source precedence,
|
||||||
|
normalization, inference, and conflicts remain consumer policy.
|
||||||
|
|
||||||
|
Entry-ID uniqueness is a semantic rule checked separately from JSON Schema.
|
||||||
|
The [validator](../../docs/validation.md) performs both checks. No cross-document identity or
|
||||||
|
reference-resolution check is part of this initial contract.
|
||||||
|
|
||||||
|
## Extensions and task instructions
|
||||||
|
|
||||||
|
Extensions describe domain information. Consumers forwarding a shared document
|
||||||
|
should retain them; task-specific projections may intentionally omit them.
|
||||||
|
Acceptance and preservation do not claim interpretation. Defined fields retain
|
||||||
|
their schema constraints in an extended document.
|
||||||
|
|
||||||
|
Task instructions belong to consumer configuration. `instruction` is not a
|
||||||
|
defined field in this contract. Like other unknown fields, it can be retained
|
||||||
|
without acquiring instruction semantics. Maintained examples contain domain
|
||||||
|
data only.
|
||||||
|
|
||||||
|
## Authoring contributions
|
||||||
|
|
||||||
|
`#/$defs/partialCollection` is an editor-assistance definition with optional
|
||||||
|
`entries`. `#/$defs/entry` and `#/$defs/collection` assist entry and complete
|
||||||
|
collection editing. A partial contribution is not a standalone valid domain
|
||||||
|
document. ConfigKit owns imports, inheritance, and composition before validation
|
||||||
|
of the complete envelope.
|
||||||
|
|
||||||
|
## Differences from the reference catalog and Audita v4.2
|
||||||
|
|
||||||
|
The old format maps collection names directly at the root. The shared format
|
||||||
|
requires `schema_version` and `collections`. It removes defined collection
|
||||||
|
instructions, permits structural extensions, and adds defined provenance.
|
||||||
|
Existing consumers must explicitly adopt this envelope and its semantics.
|
||||||
8
go.mod
8
go.mod
@@ -4,7 +4,11 @@ go 1.27.0
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3
|
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3
|
||||||
go.yaml.in/yaml/v4 v4.0.0
|
go.maximumdirect.net/configkit v1.4.0
|
||||||
|
golang.org/x/mod v0.43.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require golang.org/x/text v0.14.0 // indirect
|
require (
|
||||||
|
go.yaml.in/yaml/v4 v4.0.0 // indirect
|
||||||
|
golang.org/x/text v0.14.0 // indirect
|
||||||
|
)
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -2,7 +2,11 @@ github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxK
|
|||||||
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28=
|
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28=
|
||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
|
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
|
||||||
|
go.maximumdirect.net/configkit v1.4.0 h1:TfOupZbQ23/ZMs+xt5lmyukCF11ekqKep8KbmFQD63o=
|
||||||
|
go.maximumdirect.net/configkit v1.4.0/go.mod h1:ewu6blSokUDCMovy8JBXAdXRikGmlHXAQpFghnPWRfs=
|
||||||
go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw=
|
go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw=
|
||||||
go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
|
go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
|
||||||
|
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
|
||||||
|
golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY=
|
||||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ func TestCatalogSelection(t *testing.T) {
|
|||||||
}
|
}
|
||||||
record := catalog.Schemas[0]
|
record := catalog.Schemas[0]
|
||||||
next := record
|
next := record
|
||||||
next.Version = "0.2.0"
|
next.Version = "99.0.0"
|
||||||
next.Path = "glossary/v0.2.0/schema.json"
|
next.Path = "glossary/v99.0.0/schema.json"
|
||||||
next.ID = schemaBase + next.Path
|
next.ID = schemaBase + next.Path
|
||||||
var schema map[string]any
|
var schema map[string]any
|
||||||
if err := json.Unmarshal(files[record.Path].Data, &schema); err != nil {
|
if err := json.Unmarshal(files[record.Path].Data, &schema); err != nil {
|
||||||
@@ -57,11 +57,12 @@ func TestCatalogSelection(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
old, err := set.Select("glossary@0.1.0")
|
old := set.schemas[record.ID]
|
||||||
|
_, err = set.Select("glossary")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
newer, err := set.Select("glossary@0.2.0")
|
newer, err := set.Select("glossary")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -72,8 +73,8 @@ func TestCatalogSelection(t *testing.T) {
|
|||||||
if err := newer.Validate(value); err == nil {
|
if err := newer.Validate(value); err == nil {
|
||||||
t.Fatal("selection did not distinguish definitions sharing a marker")
|
t.Fatal("selection did not distinguish definitions sharing a marker")
|
||||||
}
|
}
|
||||||
if _, err := set.Select("glossary"); err == nil {
|
if _, err := set.Select("glossary@0.1.0"); err == nil {
|
||||||
t.Fatal("implicit latest selection accepted")
|
t.Fatal("historical selection accepted")
|
||||||
}
|
}
|
||||||
for _, change := range []func(){
|
for _, change := range []func(){
|
||||||
func() { catalog.Schemas = append(catalog.Schemas, record) },
|
func() { catalog.Schemas = append(catalog.Schemas, record) },
|
||||||
|
|||||||
@@ -1,256 +1,17 @@
|
|||||||
// Package validation supports this repository's contract checks. It is not a
|
// Package validation supports the repository's internal contract checks.
|
||||||
// consumer SDK: consumers may use their own conforming YAML and schema tools.
|
|
||||||
package validation
|
package validation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"go.maximumdirect.net/configkit"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"go.yaml.in/yaml/v4"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Decode uses the standard JSON decoder for JSON syntax and go-yaml otherwise,
|
// LoadDomain acquires a completed domain mapping through the pinned native
|
||||||
// adapting both to the documented data model without losing number precision.
|
// ConfigKit boundary. Schema and semantic validation consume its result directly.
|
||||||
func Decode(data []byte) (any, error) {
|
func LoadDomain(label string, data []byte) (map[string]any, error) {
|
||||||
if json.Valid(data) {
|
result, err := configkit.Load[map[string]any](configkit.Bytes(label, data))
|
||||||
d := json.NewDecoder(bytes.NewReader(data))
|
|
||||||
d.UseNumber()
|
|
||||||
value, err := jsonValue(d, "")
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("decode: %w", err)
|
|
||||||
}
|
|
||||||
return value, nil
|
|
||||||
}
|
|
||||||
var document yaml.Node
|
|
||||||
if err := yaml.Load(data, &document, yaml.WithUniqueKeys()); err != nil {
|
|
||||||
return nil, fmt.Errorf("decode: %w", err)
|
|
||||||
}
|
|
||||||
d := decoder{active: make(map[*yaml.Node]bool), values: make(map[*yaml.Node]any)}
|
|
||||||
value, err := d.value(&document, "")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("decode: %w", err)
|
return nil, fmt.Errorf("load: %w", err)
|
||||||
}
|
}
|
||||||
return value, nil
|
return result.Config, nil
|
||||||
}
|
|
||||||
|
|
||||||
// jsonValue consumes library-decoded tokens so duplicate keys, including keys
|
|
||||||
// with equivalent escape spellings, cannot be lost in a map unmarshalling step.
|
|
||||||
// Decode has already checked that the input is one syntactically valid value.
|
|
||||||
func jsonValue(d *json.Decoder, path string) (any, error) {
|
|
||||||
token, err := d.Token()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
switch token {
|
|
||||||
case json.Delim('{'):
|
|
||||||
value := make(map[string]any)
|
|
||||||
for d.More() {
|
|
||||||
token, err := d.Token()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
key := token.(string) // Valid JSON objects have string keys.
|
|
||||||
childPath := path + "/" + escape(key)
|
|
||||||
if _, exists := value[key]; exists {
|
|
||||||
return nil, fmt.Errorf("%s (byte %d): duplicate mapping key %q", pointer(childPath), d.InputOffset(), key)
|
|
||||||
}
|
|
||||||
value[key], err = jsonValue(d, childPath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_, err = d.Token() // Closing brace.
|
|
||||||
return value, err
|
|
||||||
case json.Delim('['):
|
|
||||||
value := make([]any, 0)
|
|
||||||
for d.More() {
|
|
||||||
child, err := jsonValue(d, fmt.Sprintf("%s/%d", path, len(value)))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
value = append(value, child)
|
|
||||||
}
|
|
||||||
_, err = d.Token() // Closing bracket.
|
|
||||||
return value, err
|
|
||||||
default:
|
|
||||||
return token, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type decoder struct {
|
|
||||||
active map[*yaml.Node]bool
|
|
||||||
values map[*yaml.Node]any
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *decoder) value(n *yaml.Node, path string) (any, error) {
|
|
||||||
if n == nil {
|
|
||||||
return nil, fmt.Errorf("%s: unresolved alias", pointer(path))
|
|
||||||
}
|
|
||||||
if d.active[n] {
|
|
||||||
return nil, nodeError(n, path, "cyclic alias")
|
|
||||||
}
|
|
||||||
if value, found := d.values[n]; found {
|
|
||||||
return value, nil
|
|
||||||
}
|
|
||||||
d.active[n] = true
|
|
||||||
defer delete(d.active, n)
|
|
||||||
var value any
|
|
||||||
var err error
|
|
||||||
switch n.Kind {
|
|
||||||
case yaml.DocumentNode:
|
|
||||||
if len(n.Content) != 1 {
|
|
||||||
return nil, nodeError(n, path, "expected one document")
|
|
||||||
}
|
|
||||||
value, err = d.value(n.Content[0], path)
|
|
||||||
case yaml.AliasNode:
|
|
||||||
value, err = d.value(n.Alias, path)
|
|
||||||
case yaml.MappingNode:
|
|
||||||
if n.ShortTag() != "!!map" {
|
|
||||||
return nil, nodeError(n, path, "unsupported mapping tag %q", n.Tag)
|
|
||||||
}
|
|
||||||
mapping := make(map[string]any, len(n.Content)/2)
|
|
||||||
for i := 0; i < len(n.Content); i += 2 {
|
|
||||||
keyValue, keyErr := d.value(n.Content[i], path)
|
|
||||||
if keyErr != nil {
|
|
||||||
return nil, keyErr
|
|
||||||
}
|
|
||||||
key, ok := keyValue.(string)
|
|
||||||
if !ok {
|
|
||||||
return nil, nodeError(n.Content[i], path, "mapping key must be a string")
|
|
||||||
}
|
|
||||||
childPath := path + "/" + escape(key)
|
|
||||||
if _, exists := mapping[key]; exists {
|
|
||||||
return nil, nodeError(n.Content[i], childPath, "duplicate mapping key %q", key)
|
|
||||||
}
|
|
||||||
mapping[key], err = d.value(n.Content[i+1], childPath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
value = mapping
|
|
||||||
case yaml.SequenceNode:
|
|
||||||
if n.ShortTag() != "!!seq" {
|
|
||||||
return nil, nodeError(n, path, "unsupported sequence tag %q", n.Tag)
|
|
||||||
}
|
|
||||||
sequence := make([]any, len(n.Content))
|
|
||||||
for i, child := range n.Content {
|
|
||||||
sequence[i], err = d.value(child, fmt.Sprintf("%s/%d", path, i))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
value = sequence
|
|
||||||
case yaml.ScalarNode:
|
|
||||||
value, err = scalar(n)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nodeError(n, path, "%v", err)
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return nil, nodeError(n, path, "expected a document value")
|
|
||||||
}
|
|
||||||
if err == nil {
|
|
||||||
d.values[n] = value
|
|
||||||
}
|
|
||||||
return value, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func scalar(n *yaml.Node) (any, error) {
|
|
||||||
switch n.ShortTag() {
|
|
||||||
case "!!str":
|
|
||||||
// go-yaml resolves decimal numbers outside machine-float range as
|
|
||||||
// strings. Plain JSON numbers still retain numeric meaning in this
|
|
||||||
// profile, including when the source serialization is JSON.
|
|
||||||
if n.Style == 0 {
|
|
||||||
if number, ok := jsonNumber(n.Value); ok {
|
|
||||||
return number, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return n.Value, nil
|
|
||||||
case "!!timestamp":
|
|
||||||
// Date-like scalars are text in the shared data model, not time.Time.
|
|
||||||
return n.Value, nil
|
|
||||||
case "!!bool", "!!null":
|
|
||||||
var value any
|
|
||||||
err := n.Decode(&value)
|
|
||||||
return value, err
|
|
||||||
case "!!int":
|
|
||||||
text := strings.ReplaceAll(n.Value, "_", "")
|
|
||||||
integer, ok := new(big.Int).SetString(text, 0)
|
|
||||||
if !ok {
|
|
||||||
integer, ok = new(big.Int).SetString(text, 10)
|
|
||||||
}
|
|
||||||
if !ok {
|
|
||||||
return nil, fmt.Errorf("invalid integer %q", n.Value)
|
|
||||||
}
|
|
||||||
return json.Number(integer.String()), nil
|
|
||||||
case "!!float":
|
|
||||||
// Normalize YAML's leading '+', '.5', and '5.' spellings, retaining the
|
|
||||||
// decimal digits instead of converting through float64.
|
|
||||||
text := strings.TrimPrefix(strings.ReplaceAll(n.Value, "_", ""), "+")
|
|
||||||
// Check syntax before supplying missing zeroes. Range errors are allowed:
|
|
||||||
// the exact decimal representation need not fit in a machine float.
|
|
||||||
if _, err := strconv.ParseFloat(text, 64); err != nil && !errors.Is(err, strconv.ErrRange) {
|
|
||||||
return nil, fmt.Errorf("invalid float %q: %w", n.Value, err)
|
|
||||||
}
|
|
||||||
mantissa, exponent, hasExponent := strings.Cut(strings.ToLower(text), "e")
|
|
||||||
sign := ""
|
|
||||||
if strings.HasPrefix(mantissa, "-") {
|
|
||||||
sign, mantissa = "-", strings.TrimPrefix(mantissa, "-")
|
|
||||||
}
|
|
||||||
whole, fraction, hasPoint := strings.Cut(mantissa, ".")
|
|
||||||
whole = strings.TrimLeft(whole, "0")
|
|
||||||
if whole == "" {
|
|
||||||
whole = "0"
|
|
||||||
}
|
|
||||||
text = sign + whole
|
|
||||||
if hasPoint {
|
|
||||||
if fraction == "" {
|
|
||||||
fraction = "0"
|
|
||||||
}
|
|
||||||
text += "." + fraction
|
|
||||||
}
|
|
||||||
if hasExponent {
|
|
||||||
text += "e" + exponent
|
|
||||||
}
|
|
||||||
if number, ok := jsonNumber(text); ok {
|
|
||||||
return number, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("number %q is not a finite JSON number", n.Value)
|
|
||||||
default:
|
|
||||||
return nil, fmt.Errorf("tag %q has no shared JSON representation", n.Tag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func jsonNumber(text string) (json.Number, bool) {
|
|
||||||
if !json.Valid([]byte(text)) {
|
|
||||||
return "", false
|
|
||||||
}
|
|
||||||
var value any
|
|
||||||
decoder := json.NewDecoder(strings.NewReader(text))
|
|
||||||
decoder.UseNumber()
|
|
||||||
if err := decoder.Decode(&value); err != nil {
|
|
||||||
return "", false
|
|
||||||
}
|
|
||||||
number, ok := value.(json.Number)
|
|
||||||
return number, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
func nodeError(n *yaml.Node, path, format string, args ...any) error {
|
|
||||||
return fmt.Errorf("%s (line %d, column %d): %s", pointer(path), n.Line, n.Column, fmt.Sprintf(format, args...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func pointer(path string) string {
|
|
||||||
if path == "" {
|
|
||||||
return "/"
|
|
||||||
}
|
|
||||||
return path
|
|
||||||
}
|
|
||||||
|
|
||||||
func escape(value string) string {
|
|
||||||
return strings.ReplaceAll(strings.ReplaceAll(value, "~", "~0"), "/", "~1")
|
|
||||||
}
|
}
|
||||||
|
|||||||
87
internal/validation/examples_test.go
Normal file
87
internal/validation/examples_test.go
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
package validation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
"testing/fstest"
|
||||||
|
)
|
||||||
|
|
||||||
|
func checkCurrentExamples(root fs.FS, set *Set) error {
|
||||||
|
for _, schema := range set.Current() {
|
||||||
|
directory := path.Join(path.Dir(schema.Record.Path), "examples")
|
||||||
|
entries, err := fs.ReadDir(root, directory)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("%s: %w", directory, err)
|
||||||
|
}
|
||||||
|
count := 0
|
||||||
|
for _, entry := range entries {
|
||||||
|
ext := path.Ext(entry.Name())
|
||||||
|
if entry.IsDir() || (ext != ".yml" && ext != ".yaml" && ext != ".json") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
count++
|
||||||
|
file := path.Join(directory, entry.Name())
|
||||||
|
data, err := fs.ReadFile(root, file)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if ext == ".json" && !json.Valid(data) {
|
||||||
|
return fmt.Errorf("%s: expected JSON syntax", file)
|
||||||
|
}
|
||||||
|
value, err := LoadDomain(file, data)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("%s: %w", file, err)
|
||||||
|
}
|
||||||
|
if err := schema.Validate(value); err != nil {
|
||||||
|
return fmt.Errorf("%s (%s): %w", file, schema.Record.Version, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count == 0 {
|
||||||
|
return fmt.Errorf("%s: no document examples", directory)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCurrentExamples(t *testing.T) {
|
||||||
|
if err := checkCurrentExamples(os.DirFS("../.."), loadSet(t)); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestExampleDiscovery(t *testing.T) {
|
||||||
|
record := Record{Name: "weather", Version: "0.1.0", Contract: "maximumdirect.weather.v1", Path: "weather/v0.1.0/schema.json", ID: schemaBase + "weather/v0.1.0/schema.json"}
|
||||||
|
data, err := json.Marshal(Catalog{FormatVersion: 1, Schemas: []Record{record}})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
schema, err := json.Marshal(map[string]any{"$schema": "https://json-schema.org/draft/2020-12/schema", "$id": record.ID, "type": "object", "required": []string{"schema_version"}, "properties": map[string]any{"schema_version": map[string]any{"const": record.Contract}}})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
example := "weather/v0.1.0/examples/weather.yml"
|
||||||
|
files := fstest.MapFS{"catalog.json": {Data: data}, record.Path: {Data: schema}, example: {Data: []byte("schema_version: maximumdirect.weather.v1\nunit: Celsius")}}
|
||||||
|
set, err := Load(files)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := checkCurrentExamples(files, set); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
files[example] = &fstest.MapFile{Data: []byte("unit: Celsius")}
|
||||||
|
if err := checkCurrentExamples(files, set); err == nil {
|
||||||
|
t.Fatal("incompatible new-name example passed")
|
||||||
|
}
|
||||||
|
delete(files, example)
|
||||||
|
if err := checkCurrentExamples(files, set); err == nil {
|
||||||
|
t.Fatal("missing example coverage passed")
|
||||||
|
}
|
||||||
|
files[path.Dir(example)] = &fstest.MapFile{Mode: fs.ModeDir}
|
||||||
|
if err := checkCurrentExamples(files, set); err == nil {
|
||||||
|
t.Fatal("empty example directory passed")
|
||||||
|
}
|
||||||
|
}
|
||||||
39
internal/validation/levels_test.go
Normal file
39
internal/validation/levels_test.go
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package validation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAlignedLevels(t *testing.T) {
|
||||||
|
set, err := Load(os.DirFS("../.."))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
schema, err := set.Select("rpg/party")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, test := range []struct{ level, phase string }{
|
||||||
|
{"1", ""}, {"9223372036854775807", ""}, {"0", "structure:"}, {"-1", "structure:"},
|
||||||
|
{"1.5", "structure:"}, {"9223372036854775808", "load:"},
|
||||||
|
{"1.0000000000000000000001", ""},
|
||||||
|
} {
|
||||||
|
t.Run(test.level, func(t *testing.T) {
|
||||||
|
body := fmt.Sprintf("schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: [{name: scout, level: %s}]}}}", test.level)
|
||||||
|
value, err := LoadDomain("party.yml", []byte(body))
|
||||||
|
if err == nil {
|
||||||
|
err = schema.Validate(value)
|
||||||
|
}
|
||||||
|
if test.phase == "" {
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
} else if err == nil || !strings.HasPrefix(err.Error(), test.phase) {
|
||||||
|
t.Fatalf("want %s, got %v", test.phase, err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
62
internal/validation/native_test.go
Normal file
62
internal/validation/native_test.go
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
package validation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestNativeHandoff(t *testing.T) {
|
||||||
|
value, err := LoadDomain("synthetic.yml", []byte(`name: "Weather 🌧"
|
||||||
|
count: 9223372036854775807
|
||||||
|
amount: 0.123456789012345678901234567890
|
||||||
|
aliases: null
|
||||||
|
entries: []
|
||||||
|
context: {}
|
||||||
|
`))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
want := map[string]any{"name": "Weather 🌧", "count": int64(9223372036854775807), "amount": float64(0.12345678901234568), "aliases": nil, "entries": []any{}, "context": map[string]any{}}
|
||||||
|
if !reflect.DeepEqual(value, want) {
|
||||||
|
t.Fatalf("native result %#v differs from %#v", value, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNativeFailures(t *testing.T) {
|
||||||
|
for _, input := range []string{
|
||||||
|
"a: 9223372036854775808", "a: 1e500", "a: yes", "a: TRUE", "a: 0x10",
|
||||||
|
"a: !!float 1", "a: &x value\nb: *x", "a: 1\na: 2", "1: value", `"<<": value`,
|
||||||
|
`{"name":"Weather \ud83c\udf27"}`, "config: {note: ordinary}",
|
||||||
|
} {
|
||||||
|
t.Run(input, func(t *testing.T) {
|
||||||
|
if _, err := LoadDomain("synthetic.yml", []byte(input)); err == nil || !strings.HasPrefix(err.Error(), "load:") {
|
||||||
|
t.Fatalf("want native failure, got %v", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNativeControls(t *testing.T) {
|
||||||
|
value, err := LoadDomain("synthetic.yml", []byte(`records:
|
||||||
|
base: {name: Base}
|
||||||
|
child: {extends: base}
|
||||||
|
context:
|
||||||
|
extends: null
|
||||||
|
config: {note: ordinary}
|
||||||
|
`))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
records := value["records"].(map[string]any)
|
||||||
|
if !reflect.DeepEqual(records["base"], records["child"]) {
|
||||||
|
t.Fatalf("inheritance did not resolve: %#v", records)
|
||||||
|
}
|
||||||
|
context := value["context"].(map[string]any)
|
||||||
|
if _, found := context["extends"]; found {
|
||||||
|
t.Fatal("extends survived as ordinary data")
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(context["config"], map[string]any{"note": "ordinary"}) {
|
||||||
|
t.Fatalf("nested config data changed: %#v", context)
|
||||||
|
}
|
||||||
|
}
|
||||||
38
internal/validation/resource_test.go
Normal file
38
internal/validation/resource_test.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package validation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/santhosh-tekuri/jsonschema/v6"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestResourceNumericConstraint(t *testing.T) {
|
||||||
|
value, err := decodeResource([]byte(`{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"integer","maximum":9223372036854775807}`))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if got := value.(map[string]any)["maximum"]; got != json.Number("9223372036854775807") {
|
||||||
|
t.Fatalf("constraint lost precision: %#v", got)
|
||||||
|
}
|
||||||
|
compiler := jsonschema.NewCompiler()
|
||||||
|
compiler.UseLoader(offlineLoader{})
|
||||||
|
if err := compiler.AddResource("urn:schemas:test:integer", value); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
schema, err := compiler.Compile("urn:schemas:test:integer")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := schema.Validate(int64(9223372036854775807)); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := schema.Validate(json.Number("9223372036854775808")); err == nil {
|
||||||
|
t.Fatal("above-bound value accepted")
|
||||||
|
}
|
||||||
|
for _, data := range []string{`{"maximum":1} {}`, `maximum: 1`} {
|
||||||
|
if _, err := decodeResource([]byte(data)); err == nil {
|
||||||
|
t.Fatalf("invalid resource accepted: %s", data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
46
internal/validation/selection_test.go
Normal file
46
internal/validation/selection_test.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package validation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"testing"
|
||||||
|
"testing/fstest"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCurrentSelection(t *testing.T) {
|
||||||
|
files := fstest.MapFS{}
|
||||||
|
catalog := Catalog{FormatVersion: 1}
|
||||||
|
for _, version := range []string{"0.9.0", "0.10.0-rc.1", "0.10.0", "0.1.0", "0.10.0+build"} {
|
||||||
|
path := "sample/v" + version + "/schema.json"
|
||||||
|
record := Record{Name: "sample", Version: version, Contract: "maximumdirect.sample.v1", ID: schemaBase + path, Path: path}
|
||||||
|
catalog.Schemas = append(catalog.Schemas, record)
|
||||||
|
data, err := json.Marshal(map[string]any{"$schema": "https://json-schema.org/draft/2020-12/schema", "$id": record.ID, "type": "object", "properties": map[string]any{"schema_version": map[string]any{"const": record.Contract}}})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
files[path] = &fstest.MapFile{Data: data}
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(catalog)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
files["catalog.json"] = &fstest.MapFile{Data: data}
|
||||||
|
set, err := Load(files)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
selected, err := set.Select("sample")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if selected.Record.Version != "0.10.0" {
|
||||||
|
t.Fatalf("selected %s", selected.Record.Version)
|
||||||
|
}
|
||||||
|
if len(set.Current()) != 1 || set.Current()[0] != selected {
|
||||||
|
t.Fatal("selection and discovery disagree")
|
||||||
|
}
|
||||||
|
for _, name := range []string{"", "missing", "sample@0.9.0"} {
|
||||||
|
if _, err := set.Select(name); err == nil {
|
||||||
|
t.Fatalf("invalid selection %q accepted", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package validation
|
package validation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@@ -9,6 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/santhosh-tekuri/jsonschema/v6"
|
"github.com/santhosh-tekuri/jsonschema/v6"
|
||||||
|
"golang.org/x/mod/semver"
|
||||||
)
|
)
|
||||||
|
|
||||||
const schemaBase = "https://schemas.maximumdirect.net/"
|
const schemaBase = "https://schemas.maximumdirect.net/"
|
||||||
@@ -28,6 +30,7 @@ type Set struct {
|
|||||||
Catalog Catalog
|
Catalog Catalog
|
||||||
schemas map[string]*Schema
|
schemas map[string]*Schema
|
||||||
selections map[string]string
|
selections map[string]string
|
||||||
|
current map[string]*Schema
|
||||||
}
|
}
|
||||||
type Schema struct {
|
type Schema struct {
|
||||||
Record Record
|
Record Record
|
||||||
@@ -41,14 +44,10 @@ func Load(root fs.FS) (*Set, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("catalog.json: %w", err)
|
return nil, fmt.Errorf("catalog.json: %w", err)
|
||||||
}
|
}
|
||||||
// Decode through the shared profile as well, so duplicate JSON keys fail.
|
|
||||||
if !json.Valid(data) {
|
if !json.Valid(data) {
|
||||||
return nil, fmt.Errorf("catalog.json: expected JSON syntax")
|
return nil, fmt.Errorf("catalog.json: expected JSON syntax")
|
||||||
}
|
}
|
||||||
if _, err := Decode(data); err != nil {
|
set := &Set{schemas: make(map[string]*Schema), selections: make(map[string]string), current: make(map[string]*Schema)}
|
||||||
return nil, fmt.Errorf("catalog.json: %w", err)
|
|
||||||
}
|
|
||||||
set := &Set{schemas: make(map[string]*Schema), selections: make(map[string]string)}
|
|
||||||
if err := json.Unmarshal(data, &set.Catalog); err != nil {
|
if err := json.Unmarshal(data, &set.Catalog); err != nil {
|
||||||
return nil, fmt.Errorf("catalog.json: %w", err)
|
return nil, fmt.Errorf("catalog.json: %w", err)
|
||||||
}
|
}
|
||||||
@@ -61,18 +60,9 @@ func Load(root fs.FS) (*Set, error) {
|
|||||||
paths := make(map[string]bool)
|
paths := make(map[string]bool)
|
||||||
for i, record := range set.Catalog.Schemas {
|
for i, record := range set.Catalog.Schemas {
|
||||||
label := fmt.Sprintf("catalog.json schemas[%d] (%s@%s)", i, record.Name, record.Version)
|
label := fmt.Sprintf("catalog.json schemas[%d] (%s@%s)", i, record.Name, record.Version)
|
||||||
if !fs.ValidPath(record.Name) || !schemaVersion.MatchString(record.Version) {
|
if !fs.ValidPath(record.Name) || !schemaVersion.MatchString(record.Version) || !semver.IsValid("v"+record.Version) {
|
||||||
return nil, fmt.Errorf("%s: invalid schema name or SemVer", label)
|
return nil, fmt.Errorf("%s: invalid schema name or SemVer", label)
|
||||||
}
|
}
|
||||||
// Numeric prerelease identifiers have no leading zero under SemVer.
|
|
||||||
pre, _, _ := strings.Cut(record.Version, "+")
|
|
||||||
if _, pre, ok := strings.Cut(pre, "-"); ok {
|
|
||||||
for _, part := range strings.Split(pre, ".") {
|
|
||||||
if len(part) > 1 && part[0] == '0' && strings.Trim(part, "0123456789") == "" {
|
|
||||||
return nil, fmt.Errorf("%s: invalid numeric prerelease identifier", label)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
expected := record.Name + "/v" + record.Version + "/schema.json"
|
expected := record.Name + "/v" + record.Version + "/schema.json"
|
||||||
contractPrefix := "maximumdirect." + strings.ReplaceAll(record.Name, "/", ".") + ".v"
|
contractPrefix := "maximumdirect." + strings.ReplaceAll(record.Name, "/", ".") + ".v"
|
||||||
generation := strings.TrimPrefix(record.Contract, contractPrefix)
|
generation := strings.TrimPrefix(record.Contract, contractPrefix)
|
||||||
@@ -98,7 +88,7 @@ func Load(root fs.FS) (*Set, error) {
|
|||||||
if !json.Valid(data) {
|
if !json.Valid(data) {
|
||||||
return nil, fmt.Errorf("%s: expected JSON syntax", record.Path)
|
return nil, fmt.Errorf("%s: expected JSON syntax", record.Path)
|
||||||
}
|
}
|
||||||
value, err := Decode(data)
|
value, err := decodeResource(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", record.Path, err)
|
return nil, fmt.Errorf("%s: %w", record.Path, err)
|
||||||
}
|
}
|
||||||
@@ -117,6 +107,10 @@ func Load(root fs.FS) (*Set, error) {
|
|||||||
paths[record.Path] = true
|
paths[record.Path] = true
|
||||||
set.selections[key] = record.ID
|
set.selections[key] = record.ID
|
||||||
set.schemas[record.ID] = &Schema{Record: record}
|
set.schemas[record.ID] = &Schema{Record: record}
|
||||||
|
previous := set.current[record.Name]
|
||||||
|
if previous == nil || semver.Compare("v"+record.Version, "v"+previous.Record.Version) > 0 {
|
||||||
|
set.current[record.Name] = set.schemas[record.ID]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Only version roots at the canonical schema paths are active contracts.
|
// Only version roots at the canonical schema paths are active contracts.
|
||||||
err = fs.WalkDir(root, ".", func(file string, entry fs.DirEntry, err error) error {
|
err = fs.WalkDir(root, ".", func(file string, entry fs.DirEntry, err error) error {
|
||||||
@@ -151,6 +145,19 @@ func Load(root fs.FS) (*Set, error) {
|
|||||||
return set, nil
|
return set, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Schema resources are JSON, not operator configuration. Preserve exact numeric
|
||||||
|
// constraints independently of the domain loader's numeric binding policy.
|
||||||
|
func decodeResource(data []byte) (any, error) {
|
||||||
|
if !json.Valid(data) {
|
||||||
|
return nil, fmt.Errorf("expected one JSON value")
|
||||||
|
}
|
||||||
|
decoder := json.NewDecoder(bytes.NewReader(data))
|
||||||
|
decoder.UseNumber()
|
||||||
|
var value any
|
||||||
|
err := decoder.Decode(&value)
|
||||||
|
return value, err
|
||||||
|
}
|
||||||
|
|
||||||
type offlineLoader struct{}
|
type offlineLoader struct{}
|
||||||
|
|
||||||
func (offlineLoader) Load(url string) (any, error) {
|
func (offlineLoader) Load(url string) (any, error) {
|
||||||
@@ -158,11 +165,25 @@ func (offlineLoader) Load(url string) (any, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Set) Select(selection string) (*Schema, error) {
|
func (s *Set) Select(selection string) (*Schema, error) {
|
||||||
id, ok := s.selections[selection]
|
schema, ok := s.current[selection]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("unknown exact schema selection %q; use name@version from catalog.json", selection)
|
return nil, fmt.Errorf("unknown schema name %q; use a name from catalog.json", selection)
|
||||||
}
|
}
|
||||||
return s.schemas[id], nil
|
return schema, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Current returns each name's highest local version in stable name order.
|
||||||
|
func (s *Set) Current() []*Schema {
|
||||||
|
names := make([]string, 0, len(s.current))
|
||||||
|
for name := range s.current {
|
||||||
|
names = append(names, name)
|
||||||
|
}
|
||||||
|
sort.Strings(names)
|
||||||
|
result := make([]*Schema, 0, len(names))
|
||||||
|
for _, name := range names {
|
||||||
|
result = append(result, s.current[name])
|
||||||
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Schema) Validate(value any) error {
|
func (s *Schema) Validate(value any) error {
|
||||||
@@ -194,3 +215,7 @@ func uniqueGlossaryIDs(collections map[string]any) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func escape(value string) string {
|
||||||
|
return strings.ReplaceAll(strings.ReplaceAll(value, "~", "~0"), "/", "~1")
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ func loadSet(t *testing.T) *Set {
|
|||||||
func TestDocuments(t *testing.T) {
|
func TestDocuments(t *testing.T) {
|
||||||
set := loadSet(t)
|
set := loadSet(t)
|
||||||
directories := []string{"tests/valid", "tests/invalid"}
|
directories := []string{"tests/valid", "tests/invalid"}
|
||||||
for _, record := range set.Catalog.Schemas {
|
for _, schema := range set.Current() {
|
||||||
directories = append(directories, filepath.Dir(record.Path)+"/examples")
|
directories = append(directories, filepath.Dir(schema.Record.Path)+"/examples")
|
||||||
}
|
}
|
||||||
for _, directory := range directories {
|
for _, directory := range directories {
|
||||||
err := filepath.WalkDir(filepath.Join("../..", directory), func(path string, entry fs.DirEntry, walkErr error) error {
|
err := filepath.WalkDir(filepath.Join("../..", directory), func(path string, entry fs.DirEntry, walkErr error) error {
|
||||||
@@ -39,7 +39,7 @@ func TestDocuments(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
value, err := Decode(data)
|
value, err := LoadDomain(path, data)
|
||||||
var before []byte
|
var before []byte
|
||||||
if err == nil {
|
if err == nil {
|
||||||
before, err = json.Marshal(value)
|
before, err = json.Marshal(value)
|
||||||
@@ -49,6 +49,9 @@ func TestDocuments(t *testing.T) {
|
|||||||
}
|
}
|
||||||
if directory == "tests/invalid" {
|
if directory == "tests/invalid" {
|
||||||
phase, _, _ := strings.Cut(entry.Name(), "-")
|
phase, _, _ := strings.Cut(entry.Name(), "-")
|
||||||
|
if phase == "decode" {
|
||||||
|
phase = "load"
|
||||||
|
}
|
||||||
if err == nil || !strings.HasPrefix(err.Error(), phase+":") {
|
if err == nil || !strings.HasPrefix(err.Error(), phase+":") {
|
||||||
t.Fatalf("want %s failure, got %v", phase, err)
|
t.Fatalf("want %s failure, got %v", phase, err)
|
||||||
}
|
}
|
||||||
@@ -100,7 +103,7 @@ func TestDefinedFieldShapes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
value, err := Decode([]byte("schema_version: maximumdirect.glossary.v1\n" + test.body))
|
value, err := LoadDomain("fixture.yml", []byte("schema_version: maximumdirect.glossary.v1\n"+test.body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -119,7 +122,7 @@ func TestDefinedFieldShapes(t *testing.T) {
|
|||||||
{"schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: null}}}", false},
|
{"schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: null}}}", false},
|
||||||
{"schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: [{name: scout, level: 0}]}}}", false},
|
{"schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: [{name: scout, level: 0}]}}}", false},
|
||||||
{"schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: [{name: scout, level: 1.5}]}}}", false},
|
{"schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: [{name: scout, level: 1.5}]}}}", false},
|
||||||
{"schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: [{name: scout, level: 1.0000000000000000000001}]}}}", false},
|
{"schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira, classes: [{name: scout, level: 1.0000000000000000000001}]}}}", true},
|
||||||
{"schema_version: maximumdirect.rpg.campaign.v1\nid: example\nreferences: {}", true},
|
{"schema_version: maximumdirect.rpg.campaign.v1\nid: example\nreferences: {}", true},
|
||||||
{"schema_version: maximumdirect.rpg.campaign.v1\nid: example\nreferences: {glossaries: []}", true},
|
{"schema_version: maximumdirect.rpg.campaign.v1\nid: example\nreferences: {glossaries: []}", true},
|
||||||
{"schema_version: maximumdirect.rpg.campaign.v1\nid: example\nreferences: {party: null}", false},
|
{"schema_version: maximumdirect.rpg.campaign.v1\nid: example\nreferences: {party: null}", false},
|
||||||
@@ -129,7 +132,7 @@ func TestDefinedFieldShapes(t *testing.T) {
|
|||||||
{"schema_version: maximumdirect.rpg.campaign.v1\nname: Example", false},
|
{"schema_version: maximumdirect.rpg.campaign.v1\nname: Example", false},
|
||||||
} {
|
} {
|
||||||
t.Run(test.body, func(t *testing.T) {
|
t.Run(test.body, func(t *testing.T) {
|
||||||
value, err := Decode([]byte(test.body))
|
value, err := LoadDomain("fixture.yml", []byte(test.body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -140,99 +143,6 @@ func TestDefinedFieldShapes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDecodeProfile(t *testing.T) {
|
|
||||||
for _, input := range []string{
|
|
||||||
"a: 1\na: 2", "a: {b: 1, b: 2}", `{"a":1,"a":2}`,
|
|
||||||
"---\na: 1\n---\na: 2", "1: value", "true: value", "? [a, b]\n: value",
|
|
||||||
"a: !custom value", "a: !!binary Zm9v", "a: !!set {x: null}", "a: !!omap [{x: 1}]",
|
|
||||||
"a: &cycle [*cycle]", "a: *unknown", "a: .inf", "a: -.Inf", "a: .NaN",
|
|
||||||
"a: !!float true", "a: !!int false", "a: [broken", "a: &x {b: 1}\nc: {<<: *x}",
|
|
||||||
`a: !!float ""`, "a: !!float e3", "a: !!float +", "a: !!float .",
|
|
||||||
} {
|
|
||||||
t.Run(input, func(t *testing.T) {
|
|
||||||
if _, err := Decode([]byte(input)); err == nil || !strings.HasPrefix(err.Error(), "decode:") {
|
|
||||||
t.Fatalf("expected decoding failure, got %v", err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
value, err := Decode([]byte(`
|
|
||||||
date: 2026-11-28
|
|
||||||
timestamp: 2026-11-28T12:30:00Z
|
|
||||||
affirmative: yes
|
|
||||||
switch: on
|
|
||||||
enabled: true
|
|
||||||
missing: ~
|
|
||||||
quoted: "true"
|
|
||||||
quoted_number: "1e500"
|
|
||||||
tagged_string: !!str 1e500
|
|
||||||
"<<": literal extension
|
|
||||||
original: &items [one, two]
|
|
||||||
copy: *items
|
|
||||||
`))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
want := map[string]any{
|
|
||||||
"date": "2026-11-28", "timestamp": "2026-11-28T12:30:00Z",
|
|
||||||
"affirmative": "yes", "switch": "on", "enabled": true, "missing": nil, "quoted": "true",
|
|
||||||
"quoted_number": "1e500", "tagged_string": "1e500",
|
|
||||||
"<<": "literal extension", "original": []any{"one", "two"}, "copy": []any{"one", "two"},
|
|
||||||
}
|
|
||||||
if !reflect.DeepEqual(value, want) {
|
|
||||||
t.Fatalf("got %#v, want %#v", value, want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestJSONDecoding(t *testing.T) {
|
|
||||||
value, err := Decode([]byte(`{"schema_version":"maximumdirect.rpg.campaign.v1","id":"weather","name":"Weather \ud83c\udf27","observations":[{"amount":0.123456789012345678901,"scale":1e500,"available":true,"missing":null}]}`))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
want := map[string]any{
|
|
||||||
"schema_version": "maximumdirect.rpg.campaign.v1", "id": "weather", "name": "Weather 🌧",
|
|
||||||
"observations": []any{map[string]any{
|
|
||||||
"amount": json.Number("0.123456789012345678901"), "scale": json.Number("1e500"),
|
|
||||||
"available": true, "missing": nil,
|
|
||||||
}},
|
|
||||||
}
|
|
||||||
if !reflect.DeepEqual(value, want) {
|
|
||||||
t.Fatalf("JSON decoding changed data: got %#v, want %#v", value, want)
|
|
||||||
}
|
|
||||||
if err := validateFixture(t, loadSet(t), value); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
for _, input := range []string{
|
|
||||||
`{"a":1,"\u0061":2}`,
|
|
||||||
`{"observations":[{"value":1,"value":2}]}`,
|
|
||||||
`{"\ud83c\udf27":1,"🌧":2}`,
|
|
||||||
} {
|
|
||||||
if _, err := Decode([]byte(input)); err == nil || !strings.Contains(err.Error(), "duplicate mapping key") {
|
|
||||||
t.Fatalf("expected duplicate-key failure for %s, got %v", input, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestNumericPrecision(t *testing.T) {
|
|
||||||
for input, want := range map[string]string{
|
|
||||||
"1234567890123456789012345678901234567890": "1234567890123456789012345678901234567890",
|
|
||||||
"0.123456789012345678901234567890": "0.123456789012345678901234567890",
|
|
||||||
".5": "0.5", "5.": "5.0", "+.5": "0.5", "-0.5": "-0.5", "1e500": "1e500",
|
|
||||||
"0x10": "16", "0o10": "8", "0b10": "2", "010": "8", "1_000": "1000",
|
|
||||||
`!!float "0"`: "0", "!!float .5": "0.5", "!!float 5.": "5.0", "!!float 1e500": "1e500",
|
|
||||||
} {
|
|
||||||
t.Run(input, func(t *testing.T) {
|
|
||||||
value, err := Decode([]byte("measurement: " + input))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
number, ok := value.(map[string]any)["measurement"].(json.Number)
|
|
||||||
if !ok || number.String() != want {
|
|
||||||
t.Fatalf("want exact JSON number %q, got %#v", want, value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestYAMLJSONEquivalence(t *testing.T) {
|
func TestYAMLJSONEquivalence(t *testing.T) {
|
||||||
yamlBytes, err := os.ReadFile("../../glossary/v0.1.0/examples/weather.yml")
|
yamlBytes, err := os.ReadFile("../../glossary/v0.1.0/examples/weather.yml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -242,11 +152,11 @@ func TestYAMLJSONEquivalence(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
yamlValue, err := Decode(yamlBytes)
|
yamlValue, err := LoadDomain("weather.yml", yamlBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
jsonValue, err := Decode(jsonBytes)
|
jsonValue, err := LoadDomain("weather.json", jsonBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -257,7 +167,7 @@ func TestYAMLJSONEquivalence(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
roundTrip, err := Decode(data)
|
roundTrip, err := LoadDomain("roundtrip.json", data)
|
||||||
if err != nil || !reflect.DeepEqual(yamlValue, roundTrip) {
|
if err != nil || !reflect.DeepEqual(yamlValue, roundTrip) {
|
||||||
t.Fatalf("JSON conversion changed data: %v", err)
|
t.Fatalf("JSON conversion changed data: %v", err)
|
||||||
}
|
}
|
||||||
@@ -267,13 +177,13 @@ func TestYAMLJSONEquivalence(t *testing.T) {
|
|||||||
// Public CLI selection is always explicit and tested separately.
|
// Public CLI selection is always explicit and tested separately.
|
||||||
func validateFixture(t *testing.T, set *Set, value any) error {
|
func validateFixture(t *testing.T, set *Set, value any) error {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
selection := "glossary@0.1.0"
|
selection := "glossary"
|
||||||
if doc, ok := value.(map[string]any); ok {
|
if doc, ok := value.(map[string]any); ok {
|
||||||
switch doc["schema_version"] {
|
switch doc["schema_version"] {
|
||||||
case "maximumdirect.rpg.party.v1":
|
case "maximumdirect.rpg.party.v1":
|
||||||
selection = "rpg/party@0.1.0"
|
selection = "rpg/party"
|
||||||
case "maximumdirect.rpg.campaign.v1":
|
case "maximumdirect.rpg.campaign.v1":
|
||||||
selection = "rpg/campaign@0.1.0"
|
selection = "rpg/campaign"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
schema, err := set.Select(selection)
|
schema, err := set.Select(selection)
|
||||||
@@ -302,19 +212,19 @@ func TestDistributionAndOfflineResolution(t *testing.T) {
|
|||||||
}
|
}
|
||||||
files[record.Path] = &fstest.MapFile{Data: data}
|
files[record.Path] = &fstest.MapFile{Data: data}
|
||||||
}
|
}
|
||||||
partyPath := "rpg/party/v0.1.0/schema.json"
|
partyPath := "rpg/party/v0.2.0/schema.json"
|
||||||
original := files[partyPath].Data
|
original := files[partyPath].Data
|
||||||
replacement := `"name": {"$ref": "` + schemaBase + `glossary/v0.1.0/schema.json#/$defs/text"}`
|
replacement := `"name": {"$ref": "` + schemaBase + `glossary/v0.2.0/schema.json#/$defs/text"}`
|
||||||
files[partyPath] = &fstest.MapFile{Data: []byte(strings.Replace(string(original), `"name": {"$ref": "#/$defs/text"}`, replacement, 1))}
|
files[partyPath] = &fstest.MapFile{Data: []byte(strings.Replace(string(original), `"name": {"$ref": "#/$defs/text"}`, replacement, 1))}
|
||||||
set, err := Load(files)
|
set, err := Load(files)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
selected, err := set.Select("rpg/party@0.1.0")
|
selected, err := set.Select("rpg/party")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
value, err := Decode([]byte("schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira}}}"))
|
value, err := LoadDomain("fixture.yml", []byte("schema_version: maximumdirect.rpg.party.v1\ncharacters: {mira: {character: {name: Mira}}}"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
9
rpg/campaign/v0.2.0/examples/campaign.yml
Normal file
9
rpg/campaign/v0.2.0/examples/campaign.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
schema_version: maximumdirect.rpg.campaign.v1
|
||||||
|
id: lantern-coast
|
||||||
|
name: Lantern Coast Expedition
|
||||||
|
description: A synthetic coastal exploration campaign.
|
||||||
|
setting: Lantern Coast
|
||||||
|
system: Sample Fantasy
|
||||||
|
references:
|
||||||
|
party: ../../../party/v0.2.0/examples/party.yml
|
||||||
|
glossaries: [../../../../glossary/v0.2.0/examples/glossary.yml]
|
||||||
23
rpg/campaign/v0.2.0/schema.json
Normal file
23
rpg/campaign/v0.2.0/schema.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://schemas.maximumdirect.net/rpg/campaign/v0.2.0/schema.json",
|
||||||
|
"title": "MAXIMUMDIRECT RPG Campaign v1",
|
||||||
|
"type": "object",
|
||||||
|
"required": ["schema_version", "id"],
|
||||||
|
"properties": {
|
||||||
|
"schema_version": {"const": "maximumdirect.rpg.campaign.v1"},
|
||||||
|
"id": {"$ref": "#/$defs/text"},
|
||||||
|
"name": {"$ref": "#/$defs/text"},
|
||||||
|
"description": {"type": "string"},
|
||||||
|
"setting": {"$ref": "#/$defs/text"},
|
||||||
|
"system": {"$ref": "#/$defs/text"},
|
||||||
|
"references": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"party": {"$ref": "#/$defs/text"},
|
||||||
|
"glossaries": {"type": "array", "items": {"$ref": "#/$defs/text"}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$defs": {"text": {"type": "string", "minLength": 1}}
|
||||||
|
}
|
||||||
52
rpg/campaign/v0.2.0/semantics.md
Normal file
52
rpg/campaign/v0.2.0/semantics.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# Campaign contract
|
||||||
|
|
||||||
|
## Native loading boundary
|
||||||
|
|
||||||
|
Full conformance includes acquisition through the public mapping-root handoff of
|
||||||
|
[ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md),
|
||||||
|
followed by this schema and its semantic checks. ConfigKit owns syntax, structural
|
||||||
|
controls, numeric binding, and resource limits, including its 8 MiB source limit.
|
||||||
|
Dynamic integers bind as int64 and fractional/exponent values as finite float64;
|
||||||
|
authored decimal precision is not guaranteed. Preserve supported resolved values.
|
||||||
|
`extends` is structural input and source-root `config` is a control namespace;
|
||||||
|
nested ordinary `config` follows upstream rules. Other supported domain extensions
|
||||||
|
remain permitted. Schema validation adds no trimming, case folding, or defaults.
|
||||||
|
Structural validation alone does not prove native loading compatibility. The
|
||||||
|
pinned upstream contract defines this version's boundary independently of later
|
||||||
|
changes to the repository's general guidance.
|
||||||
|
|
||||||
|
Contract: `maximumdirect.rpg.campaign.v1`. [Schema](schema.json).
|
||||||
|
The [validation profile](../../../docs/validation.md) and [compatibility rules](../../../docs/compatibility.md)
|
||||||
|
apply. See the [example](examples/campaign.yml).
|
||||||
|
|
||||||
|
| Field | Required | Meaning |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `schema_version` | Yes | Exactly `maximumdirect.rpg.campaign.v1`. |
|
||||||
|
| `id` | Yes | Nonempty stable campaign identity, independent of its display name. |
|
||||||
|
| `name` | No | Nonempty campaign display name. |
|
||||||
|
| `description` | No | Free text campaign context; an empty string is valid. |
|
||||||
|
| `setting` | No | Nonempty domain setting label or identifier. |
|
||||||
|
| `system` | No | Nonempty game-system label or identifier. |
|
||||||
|
| `references` | No | Relationships to domain documents. |
|
||||||
|
| `references.party` | No | Nonempty locator for a party document. |
|
||||||
|
| `references.glossaries` | No | List of nonempty locators for glossary documents; may be empty. |
|
||||||
|
|
||||||
|
Optional fields accept omission, not null. An empty `references` object is
|
||||||
|
valid. Objects allow additional fields. IDs, labels, and locator strings are
|
||||||
|
preserved as supported resolved values without domain normalization. The issuer supplies the identity's namespace;
|
||||||
|
this contract does not require globally unique campaign IDs.
|
||||||
|
|
||||||
|
References are locator strings, including URI references and relative file
|
||||||
|
references. Consumers select supported locator forms and resolve relative
|
||||||
|
references against the domain document's location (or a base
|
||||||
|
provided with an in-memory document). Resolving authored configuration paths
|
||||||
|
before this boundary remains the composing application's responsibility.
|
||||||
|
References express relationships; the harness neither fetches them nor requires
|
||||||
|
local installation. List order does not prescribe merge order, precedence, or
|
||||||
|
execution. Those belong to the consuming application.
|
||||||
|
|
||||||
|
This document records shared context. Narratio's `campaign.yml` remains
|
||||||
|
application configuration with its own operational fields. Session templates,
|
||||||
|
speaker-file choices, execution paths, provider policy, and credentials are
|
||||||
|
outside the defined shared campaign fields. Additional fields gain no execution
|
||||||
|
or credential semantics through schema conformance.
|
||||||
15
rpg/party/v0.2.0/examples/party.yml
Normal file
15
rpg/party/v0.2.0/examples/party.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
schema_version: maximumdirect.rpg.party.v1
|
||||||
|
characters:
|
||||||
|
mira:
|
||||||
|
player:
|
||||||
|
name: Rowan
|
||||||
|
character:
|
||||||
|
name: Mira Vale
|
||||||
|
aliases: [Mira, The Lantern]
|
||||||
|
classes:
|
||||||
|
- name: ranger
|
||||||
|
level: 3
|
||||||
|
homeland: Lantern Coast
|
||||||
|
guide-npc:
|
||||||
|
character:
|
||||||
|
name: Tavi
|
||||||
51
rpg/party/v0.2.0/schema.json
Normal file
51
rpg/party/v0.2.0/schema.json
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://schemas.maximumdirect.net/rpg/party/v0.2.0/schema.json",
|
||||||
|
"title": "MAXIMUMDIRECT RPG Party v1",
|
||||||
|
"type": "object",
|
||||||
|
"required": ["schema_version", "characters"],
|
||||||
|
"properties": {
|
||||||
|
"schema_version": {"const": "maximumdirect.rpg.party.v1"},
|
||||||
|
"characters": {
|
||||||
|
"type": "object",
|
||||||
|
"propertyNames": {"minLength": 1},
|
||||||
|
"additionalProperties": {"$ref": "#/$defs/rosterEntry"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$defs": {
|
||||||
|
"text": {"type": "string", "minLength": 1},
|
||||||
|
"rosterEntry": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["character"],
|
||||||
|
"properties": {
|
||||||
|
"player": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["name"],
|
||||||
|
"properties": {"name": {"$ref": "#/$defs/text"}}
|
||||||
|
},
|
||||||
|
"character": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["name"],
|
||||||
|
"properties": {
|
||||||
|
"name": {"$ref": "#/$defs/text"},
|
||||||
|
"aliases": {
|
||||||
|
"type": ["array", "null"],
|
||||||
|
"items": {"$ref": "#/$defs/text"}
|
||||||
|
},
|
||||||
|
"classes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["name"],
|
||||||
|
"properties": {
|
||||||
|
"name": {"$ref": "#/$defs/text"},
|
||||||
|
"level": {"type": "integer", "minimum": 1, "maximum": 9223372036854775807}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
54
rpg/party/v0.2.0/semantics.md
Normal file
54
rpg/party/v0.2.0/semantics.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# Party contract
|
||||||
|
|
||||||
|
## Native loading boundary
|
||||||
|
|
||||||
|
Full conformance includes acquisition through the public mapping-root handoff of
|
||||||
|
[ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md),
|
||||||
|
followed by this schema and its semantic checks. ConfigKit owns syntax, structural
|
||||||
|
controls, numeric binding, and resource limits, including its 8 MiB source limit.
|
||||||
|
Dynamic integers bind as int64 and fractional/exponent values as finite float64;
|
||||||
|
authored decimal precision is not guaranteed. Preserve supported resolved values.
|
||||||
|
`extends` is structural input and source-root `config` is a control namespace;
|
||||||
|
nested ordinary `config` follows upstream rules. Other supported domain extensions
|
||||||
|
remain permitted. Schema validation adds no trimming, case folding, or defaults.
|
||||||
|
Structural validation alone does not prove native loading compatibility. The
|
||||||
|
pinned upstream contract defines this version's boundary independently of later
|
||||||
|
changes to the repository's general guidance.
|
||||||
|
|
||||||
|
Contract: `maximumdirect.rpg.party.v1`. [Schema](schema.json).
|
||||||
|
The [validation profile](../../../docs/validation.md) and [compatibility rules](../../../docs/compatibility.md)
|
||||||
|
apply. See the [example](examples/party.yml).
|
||||||
|
|
||||||
|
| Field | Required | Meaning |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `schema_version` | Yes | Exactly `maximumdirect.rpg.party.v1`. |
|
||||||
|
| `characters` | Yes | Mapping from stable character IDs to roster entries; an empty mapping is valid. |
|
||||||
|
| `characters.<id>.character` | Yes | Character information. |
|
||||||
|
| `character.name` | Yes | Nonempty canonical display name. |
|
||||||
|
| `character.aliases` | No | Alternative names for the same character; omission, null, an empty list, or a list of nonempty strings. |
|
||||||
|
| `character.classes` | No | List of class objects, possibly empty. Each has a nonempty `name` and optional integer `level` from 1 through 9223372036854775807 after native binding. |
|
||||||
|
| `characters.<id>.player` | No | Player relationship. When present, an object with a required nonempty `name`. Multiple characters may have the same player. |
|
||||||
|
|
||||||
|
IDs are nonempty strings scoped to this party, independent of display names and
|
||||||
|
application artifact names. They remain stable when a display name changes.
|
||||||
|
Player names are display labels, not globally unique player identifiers.
|
||||||
|
Equal character names and aliases do not establish identity; consumers decide
|
||||||
|
how to handle ambiguity in a particular task. Supported strings are preserved in the resolved handoff.
|
||||||
|
|
||||||
|
Every object permits additional fields. Classes are optional domain information
|
||||||
|
for campaigns that use them. Other character attributes may be extensions.
|
||||||
|
Known fields have the documented type even when other fields are present.
|
||||||
|
Optional objects and `classes` accept omission, not null. List order carries no
|
||||||
|
additional contract meaning; mapping order never establishes character order.
|
||||||
|
|
||||||
|
A consumer can derive a party glossary from this roster. It uses character IDs
|
||||||
|
as entry IDs, canonical names and aliases, and its selected domain category.
|
||||||
|
Operators need not maintain a duplicate party vocabulary document.
|
||||||
|
|
||||||
|
## Differences from Narratio's existing party input
|
||||||
|
|
||||||
|
This contract uses a shared marker and `aliases` rather than `alias`. Player and
|
||||||
|
class information is optional. IDs follow domain identity rather than artifact
|
||||||
|
key syntax. Name uniqueness, class requirements, and mapping iteration order are
|
||||||
|
consumer decisions. Narratio's existing `narratio.party.v1` format remains a
|
||||||
|
separate released interface until adoption is implemented.
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# Historical broad-profile fixture for the 2026.11.0 tool.
|
||||||
schema_version: maximumdirect.glossary.v1
|
schema_version: maximumdirect.glossary.v1
|
||||||
recorded_at: 2026-11-28
|
recorded_at: 2026-11-28
|
||||||
source_context: &context
|
source_context: &context
|
||||||
Reference in New Issue
Block a user