Files
portal/docs/registry/schema.json
T
Дмитрий 89fd9d0e42 fix(registry): schema tightening per code review (I-1/I-2/I-3)
I-1: weight range 0-1 added to classification + file_pattern trigger
     variants (раньше было только на keyword) — иначе weight=50 silent
     ranking-bug в Task 3 indexByTrigger.

I-2: additionalProperties:false на 3 trigger-variant объекты — ясная
     ajv-ошибка при mixed-key (keyword+classification одновременно).

I-3: additionalProperties:false на definitions.node и definitions.chain
     — typo ("categori" / "keywrod") теперь reject'ится, не silently
     accepted.

Smoke-проверка: 3 теста — weight=50 reject, typo categori reject, valid
accept. ajv compile OK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 14:13:02 +03:00

74 lines
2.8 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://liderra.local/registry-schema.json",
"title": "Liderra Node Registry",
"type": "object",
"required": ["version", "nodes", "chains"],
"properties": {
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
"nodes": {
"type": "array",
"items": { "$ref": "#/definitions/node" }
},
"chains": {
"type": "object",
"patternProperties": {
"^L\\d+$": { "$ref": "#/definitions/chain" }
}
}
},
"definitions": {
"node": {
"type": "object",
"required": ["id", "name", "slug", "category", "status", "triggers"],
"properties": {
"id": { "type": "string", "pattern": "^#\\d+$" },
"name": { "type": "string", "minLength": 3 },
"slug": { "type": "string", "pattern": "^[a-z0-9-]+(:[a-z0-9-]+)*$" },
"category": { "enum": ["phase-0", "phase-1", "phase-2", "phase-3", "off-phase"] },
"subcategory": { "type": ["string", "null"] },
"status": { "enum": ["active", "dormant", "deferred", "historic"] },
"dormancy_reason": { "type": ["string", "null"] },
"triggers": {
"type": "array",
"items": {
"oneOf": [
{ "type": "object", "required": ["keyword"], "properties": { "keyword": { "type": "string" }, "weight": { "type": "number", "minimum": 0, "maximum": 1 } }, "additionalProperties": false },
{ "type": "object", "required": ["classification"], "properties": { "classification": { "type": "string" }, "weight": { "type": "number", "minimum": 0, "maximum": 1 } }, "additionalProperties": false },
{ "type": "object", "required": ["file_pattern"], "properties": { "file_pattern": { "type": "string" }, "weight": { "type": "number", "minimum": 0, "maximum": 1 } }, "additionalProperties": false }
]
}
},
"boundaries": {
"type": "array",
"items": {
"type": "object",
"properties": {
"adr": { "type": "string", "pattern": "^ADR-\\d{3}$" },
"pair": { "type": "string", "pattern": "^#\\d+$" },
"relation": { "type": "string" },
"role": { "type": "string" }
}
}
},
"chain_membership": {
"type": "array",
"items": { "type": "string", "pattern": "^L\\d+$" }
},
"attributes": { "type": "object" }
},
"additionalProperties": false
},
"chain": {
"type": "object",
"required": ["name", "sequence"],
"properties": {
"name": { "type": "string" },
"sequence": { "type": "array", "items": { "type": "string" }, "minItems": 2 },
"triggers": { "type": "array" }
},
"additionalProperties": false
}
}
}