From 8bc3ae56cb90f8334f29ecf880fda4cdd95e070c Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sun, 29 Nov 2026 23:53:17 +0000 Subject: [PATCH] Bundle shared domain contracts and validation --- docs/oss/attribution.md | 14 +++ docs/roadmap/implementation.md | 5 + .../resources/glossary/v0.2.0/schema.json | 51 ++++++++ .../resources/glossary/v0.2.0/semantics.md | 83 +++++++++++++ .../resources/rpg/campaign/v0.2.0/schema.json | 23 ++++ .../rpg/campaign/v0.2.0/semantics.md | 52 ++++++++ .../resources/rpg/party/v0.2.0/schema.json | 51 ++++++++ .../resources/rpg/party/v0.2.0/semantics.md | 54 +++++++++ internal/domaininput/validate.go | 112 ++++++++++++++++++ internal/domaininput/validate_test.go | 56 +++++++++ 10 files changed, 501 insertions(+) create mode 100644 internal/domaininput/resources/glossary/v0.2.0/schema.json create mode 100644 internal/domaininput/resources/glossary/v0.2.0/semantics.md create mode 100644 internal/domaininput/resources/rpg/campaign/v0.2.0/schema.json create mode 100644 internal/domaininput/resources/rpg/campaign/v0.2.0/semantics.md create mode 100644 internal/domaininput/resources/rpg/party/v0.2.0/schema.json create mode 100644 internal/domaininput/resources/rpg/party/v0.2.0/semantics.md create mode 100644 internal/domaininput/validate.go create mode 100644 internal/domaininput/validate_test.go diff --git a/docs/oss/attribution.md b/docs/oss/attribution.md index f536e5d..92d9131 100644 --- a/docs/oss/attribution.md +++ b/docs/oss/attribution.md @@ -315,6 +315,20 @@ License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) | [Source](https://github.com/golang/text/commit/6c97a165dd661335ff7bce6104a008558123c353). +## Maximum Direct shared schemas + +Material: `internal/domaininput/resources/`, copied without modification from `2026.11.1`. + +Copyright 2026 Eric Rakestraw + +SPDX-License-Identifier: CC0-1.0 + +License and notices: [CC0 1.0](licenses/CC0-1.0.txt) | +[COPYRIGHT](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/COPYRIGHT) | +[LICENSE](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/LICENSE). + +[Source](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7). + ## Narratio reference catalog Material: `internal/glossary/glossary-v1.schema.json`. diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 8c9125c..629d430 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -91,6 +91,11 @@ library APIs and the existing implementation boundaries. ## Stage 1 — Bundle shared contracts and add offline domain validation +**Complete.** Commit: `Bundle shared domain contracts and validation`. +Verification: `go test ./internal/domaininput ./internal/glossary ./internal/doccheck` +with Go 1.27.4 passed. The existing private glossary validator remains in use +until its callers migrate to shared envelopes in later stages. + **Read:** roadmap “Shared acquisition and prepared inputs”; schema release validation and each selected semantic document; OSS policy. Entry points: `internal/glossary/glossary.go`, existing schema resources, and `go.mod`. diff --git a/internal/domaininput/resources/glossary/v0.2.0/schema.json b/internal/domaininput/resources/glossary/v0.2.0/schema.json new file mode 100644 index 0000000..c5121ca --- /dev/null +++ b/internal/domaininput/resources/glossary/v0.2.0/schema.json @@ -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"]}] + } + } +} diff --git a/internal/domaininput/resources/glossary/v0.2.0/semantics.md b/internal/domaininput/resources/glossary/v0.2.0/semantics.md new file mode 100644 index 0000000..b9f66df --- /dev/null +++ b/internal/domaininput/resources/glossary/v0.2.0/semantics.md @@ -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..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..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. diff --git a/internal/domaininput/resources/rpg/campaign/v0.2.0/schema.json b/internal/domaininput/resources/rpg/campaign/v0.2.0/schema.json new file mode 100644 index 0000000..cf9055b --- /dev/null +++ b/internal/domaininput/resources/rpg/campaign/v0.2.0/schema.json @@ -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}} +} diff --git a/internal/domaininput/resources/rpg/campaign/v0.2.0/semantics.md b/internal/domaininput/resources/rpg/campaign/v0.2.0/semantics.md new file mode 100644 index 0000000..b24d0bb --- /dev/null +++ b/internal/domaininput/resources/rpg/campaign/v0.2.0/semantics.md @@ -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. diff --git a/internal/domaininput/resources/rpg/party/v0.2.0/schema.json b/internal/domaininput/resources/rpg/party/v0.2.0/schema.json new file mode 100644 index 0000000..80cd4b9 --- /dev/null +++ b/internal/domaininput/resources/rpg/party/v0.2.0/schema.json @@ -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} + } + } + } + } + } + } + } + } +} diff --git a/internal/domaininput/resources/rpg/party/v0.2.0/semantics.md b/internal/domaininput/resources/rpg/party/v0.2.0/semantics.md new file mode 100644 index 0000000..f1873f4 --- /dev/null +++ b/internal/domaininput/resources/rpg/party/v0.2.0/semantics.md @@ -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..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..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. diff --git a/internal/domaininput/validate.go b/internal/domaininput/validate.go new file mode 100644 index 0000000..0a0ab9d --- /dev/null +++ b/internal/domaininput/validate.go @@ -0,0 +1,112 @@ +// Package domaininput validates completed shared domain mappings. +package domaininput + +import ( + "bytes" + "embed" + "encoding/json" + "fmt" + "sort" + "sync" + + "github.com/santhosh-tekuri/jsonschema/v6" +) + +// SourceRevision identifies the release from which the bundled resources came. +const SourceRevision = "f7e3cedeca11ed903311cdf29ca4d81fb1f216b7" + +const schemaBase = "https://schemas.maximumdirect.net/" + +//go:embed resources/*/v0.2.0/schema.json resources/rpg/*/v0.2.0/schema.json +var resources embed.FS + +var compiled struct { + sync.Once + schemas map[string]*jsonschema.Schema + err error +} + +type offlineLoader struct{} + +func (offlineLoader) Load(url string) (any, error) { + return nil, fmt.Errorf("schema resource %q is not bundled", url) +} + +func schema(name string) (*jsonschema.Schema, error) { + compiled.Do(func() { + compiler := jsonschema.NewCompiler() + compiler.UseLoader(offlineLoader{}) + compiled.schemas = make(map[string]*jsonschema.Schema) + names := []string{"glossary", "rpg/party", "rpg/campaign"} + for _, name := range names { + path := name + "/v0.2.0/schema.json" + data, err := resources.ReadFile("resources/" + path) + if err != nil { + compiled.err = err + return + } + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.UseNumber() + var document any + if err := decoder.Decode(&document); err != nil { + compiled.err = err + return + } + if err := compiler.AddResource(schemaBase+path, document); err != nil { + compiled.err = err + return + } + } + for _, name := range names { + var err error + compiled.schemas[name], err = compiler.Compile(schemaBase + name + "/v0.2.0/schema.json") + if err != nil { + compiled.err = err + return + } + } + }) + return compiled.schemas[name], compiled.err +} + +func validate(name string, value map[string]any) error { + s, err := schema(name) + if err != nil { + return fmt.Errorf("compile shared schemas: %w", err) + } + if err := s.Validate(value); err != nil { + return fmt.Errorf("%s: %w", name, err) + } + return nil +} + +// ValidateCampaign validates a completed shared campaign mapping. +func ValidateCampaign(value map[string]any) error { return validate("rpg/campaign", value) } + +// ValidateParty validates a completed shared party mapping. +func ValidateParty(value map[string]any) error { return validate("rpg/party", value) } + +// ValidateGlossary validates a completed shared glossary and collection IDs. +func ValidateGlossary(value map[string]any) error { + if err := validate("glossary", value); err != nil { + return err + } + collections := value["collections"].(map[string]any) + names := make([]string, 0, len(collections)) + for name := range collections { + names = append(names, name) + } + sort.Strings(names) + for _, name := range names { + entries := collections[name].(map[string]any)["entries"].([]any) + seen := make(map[string]bool, len(entries)) + for _, entry := range entries { + id := entry.(map[string]any)["id"].(string) + if seen[id] { + return fmt.Errorf("collection %q: duplicate entry id %q", name, id) + } + seen[id] = true + } + } + return nil +} diff --git a/internal/domaininput/validate_test.go b/internal/domaininput/validate_test.go new file mode 100644 index 0000000..1bb0d8b --- /dev/null +++ b/internal/domaininput/validate_test.go @@ -0,0 +1,56 @@ +package domaininput + +import ( + "encoding/json" + "testing" + + "go.maximumdirect.net/configkit" +) + +func TestSharedContracts(t *testing.T) { + entry := func(id string, aliases any) map[string]any { + return map[string]any{"id": id, "name": "Lantern", "category": "place", "aliases": aliases, "extra": map[string]any{"detail": true}} + } + glossary := func(entries ...any) map[string]any { + return map[string]any{"schema_version": "maximumdirect.glossary.v1", "collections": map[string]any{"campaign": map[string]any{"entries": entries, "instruction": "data"}}} + } + party := func(level any) map[string]any { + return map[string]any{"schema_version": "maximumdirect.rpg.party.v1", "characters": map[string]any{"one": map[string]any{"character": map[string]any{"name": "A", "aliases": nil, "classes": []any{map[string]any{"name": "Fighter", "level": level}}}}}} + } + cases := []struct { + name string + validate func(map[string]any) error + value map[string]any + valid bool + }{ + {"glossary null aliases", ValidateGlossary, glossary(entry("a", nil)), true}, + {"glossary empty aliases", ValidateGlossary, glossary(entry("a", []any{})), true}, + {"glossary duplicates", ValidateGlossary, glossary(entry("a", nil), entry("a", nil)), false}, + {"glossary known shape", ValidateGlossary, glossary(map[string]any{"id": "a"}), false}, + {"party max level", ValidateParty, party(json.Number("9223372036854775807")), true}, + {"party beyond max level", ValidateParty, party(json.Number("9223372036854775808")), false}, + {"party zero level", ValidateParty, party(int64(0)), false}, + {"campaign extension", ValidateCampaign, map[string]any{"schema_version": "maximumdirect.rpg.campaign.v1", "id": "example", "extension": []any{nil, "value"}}, true}, + {"campaign null known field", ValidateCampaign, map[string]any{"schema_version": "maximumdirect.rpg.campaign.v1", "id": "example", "setting": nil}, false}, + {"campaign wrong marker", ValidateCampaign, map[string]any{"schema_version": "other", "id": "example"}, false}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + err := tc.validate(tc.value) + if (err == nil) != tc.valid { + t.Fatalf("valid = %v, error = %v", tc.valid, err) + } + }) + } +} + +func TestNativeResolvedParty(t *testing.T) { + data := []byte("schema_version: maximumdirect.rpg.party.v1\ncharacters:\n a:\n character:\n name: Example\n classes:\n - name: Fighter\n level: 9223372036854775807\n") + result, err := configkit.Load(configkit.Bytes("party.yml", data), configkit.Options[map[string]any]{}) + if err != nil { + t.Fatal(err) + } + if err := ValidateParty(result.Config); err != nil { + t.Fatal(err) + } +}