Define the nine JSON Schemas (draft 2020-12) exchanged between compiler stages per MASTER_SPEC §10–§11, plus a reusable validation helper. Schemas (schemas/json/, cross-referenced by $id): - scene, character, concept, interaction, metadata, knowledge_base_entry, resolved_tag, category_map, prompt_output - Scene requires all seven sections (collections may be empty); Concept is a bare string or an object with required name; Character has an integer id plus seven concept arrays; Interaction has integer participants and a concept. - Each schema carries a major.minor version; unknown fields rejected by default. Helper (schemas/validation.py): - validate_document(doc, schema_name, *, allow_unknown=False) -> list of structured ValidationIssue (empty = valid); collects all errors. - Loads all schemas into a referencing registry so cross-schema $ref resolves. - allow_unknown relaxes additionalProperties per config without duplicating schemas (schema-valued additionalProperties, e.g. Category Map, is preserved). Tests: valid + several invalid documents per schema, unknown-field toggle, unknown-schema error (34 assertions). Bumps jsonschema to >=4.18 for referencing. Co-authored-by: kunail0804 <kunail0804@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
30 lines
1022 B
JSON
30 lines
1022 B
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "character",
|
|
"version": "1.0",
|
|
"title": "Character",
|
|
"description": "A human, creature, or identifiable subject. MASTER_SPEC §9.2 / §10.2 / §11.2. All fields are required; concept arrays MAY be empty.",
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"identity",
|
|
"appearance",
|
|
"clothing",
|
|
"accessories",
|
|
"pose",
|
|
"expression",
|
|
"actions"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"id": { "type": "integer" },
|
|
"identity": { "type": "array", "items": { "$ref": "concept" } },
|
|
"appearance": { "type": "array", "items": { "$ref": "concept" } },
|
|
"clothing": { "type": "array", "items": { "$ref": "concept" } },
|
|
"accessories": { "type": "array", "items": { "$ref": "concept" } },
|
|
"pose": { "type": "array", "items": { "$ref": "concept" } },
|
|
"expression": { "type": "array", "items": { "$ref": "concept" } },
|
|
"actions": { "type": "array", "items": { "$ref": "concept" } }
|
|
}
|
|
}
|