feat(api): origin seed JSON Schema + validator
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
52
docs/schemas/origin.schema.json
Normal file
52
docs/schemas/origin.schema.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://coc-rpg/schemas/origin.schema.json",
|
||||
"title": "Origin Seed",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"schema_version", "id", "display_name", "description",
|
||||
"start_location_id", "situation", "opening_facts",
|
||||
"disposition_overrides", "inventory_grants", "start_quest_id",
|
||||
"build_constraints"
|
||||
],
|
||||
"properties": {
|
||||
"schema_version": { "type": "integer", "const": 1 },
|
||||
"id": { "type": "string", "pattern": "^[a-z0-9_]+$" },
|
||||
"display_name": { "type": "string", "minLength": 1 },
|
||||
"description": { "type": "string", "minLength": 1 },
|
||||
"start_location_id": { "type": "string", "pattern": "^[a-z0-9_]+$" },
|
||||
"situation": { "type": "array", "items": { "type": "string", "minLength": 1 } },
|
||||
"opening_facts": { "type": "array", "items": { "type": "string", "minLength": 1 } },
|
||||
"disposition_overrides": {
|
||||
"type": "object",
|
||||
"additionalProperties": { "type": "integer", "minimum": -100, "maximum": 100 }
|
||||
},
|
||||
"inventory_grants": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["item_id", "qty"],
|
||||
"properties": {
|
||||
"item_id": { "type": "string", "pattern": "^[a-z0-9_]+$" },
|
||||
"qty": { "type": "integer", "minimum": 1 }
|
||||
}
|
||||
}
|
||||
},
|
||||
"start_quest_id": { "type": ["string", "null"], "pattern": "^[a-z0-9_]+$" },
|
||||
"build_constraints": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["allowed_classes", "luck_modifier"],
|
||||
"properties": {
|
||||
"allowed_classes": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": { "enum": ["sellsword", "assassin", "priest"] }
|
||||
},
|
||||
"luck_modifier": { "type": "integer" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user