Files
kunail0804-ComfyUI-Scene-Co…/schemas/json/knowledge_base_entry.schema.json
T
07b0f9a18b feat(knowledge-base): define KB file format, entry rules, and categories (#8) (#51)
Formalize the Knowledge Base on-disk format and tighten the entry schema per
MASTER_SPEC §15.3-§15.10, §18.2.

- compiler/common/categories.py: single source of truth for the 19 canonical
  categories (lowercase identifiers of the §18.2 list) plus is_valid_category.
- knowledge_base_entry.schema.json (v1.1): category restricted to the 19; tags
  require at least one item; expand entries must be snake_case canonical ids;
  aliases uniqueItems.
- knowledge_base/README.md: by-domain file layout, the "each file is a JSON array
  of entries" format, and contributor field rules (id/alias global uniqueness,
  tag order, expansion targets, one-tag minimum).
- examples/knowledge_base.example.json: worked file demonstrating an alias and an
  expansion.

Cross-entry rules (global uniqueness, expand targets exist) are deferred to the
KB validation tooling (#9); this issue defines per-entry structure only.

Tests: 19-category constant and schema-enum consistency, entry validation
(category/tags/id/expand/unknown-field), and the worked example (array shape,
per-entry validity, alias+expansion present, expand targets resolve).

Co-authored-by: kunail0804 <kunail0804@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 19:23:50 +02:00

54 lines
1.4 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "knowledge_base_entry",
"version": "1.1",
"title": "Knowledge Base Entry",
"description": "A canonical Knowledge Base concept. MASTER_SPEC §11.6, §15.4-§15.10. Cross-entry rules (global uniqueness of ids/aliases, expand targets exist) are enforced by the KB validation tooling, not this per-entry schema.",
"type": "object",
"required": ["id", "tags", "category"],
"additionalProperties": false,
"properties": {
"id": { "type": "string", "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$" },
"aliases": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
},
"tags": {
"type": "array",
"items": { "type": "string" },
"minItems": 1
},
"category": {
"type": "string",
"enum": [
"character",
"appearance",
"hair",
"face",
"eyes",
"expression",
"body",
"clothing",
"accessories",
"pose",
"action",
"interaction",
"objects",
"environment",
"camera",
"lighting",
"style",
"quality",
"miscellaneous"
]
},
"expand": {
"type": "array",
"items": { "type": "string", "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$" }
},
"deprecated": { "type": "boolean" },
"notes": { "type": "string" }
}
}