41 lines
2.3 KiB
JSON
41 lines
2.3 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"title": "CAD knowledge document metadata",
|
|
"type": "object",
|
|
"required": ["doc_id", "kind", "schema_version", "knowledge_version", "status", "name_zh", "sources"],
|
|
"properties": {
|
|
"doc_id": {"type": "string", "pattern": "^[a-z][a-z0-9-]+$"},
|
|
"kind": {"enum": ["family", "feature", "common", "example"]},
|
|
"schema_version": {"const": "1.0"},
|
|
"knowledge_version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"},
|
|
"status": {"enum": ["draft", "reviewed", "retrieval_verified"]},
|
|
"name_zh": {"type": "string", "minLength": 2},
|
|
"name_en": {"type": "string", "minLength": 2},
|
|
"aliases": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
|
|
"entity_kind": {"enum": ["single_part", "multi_part"]},
|
|
"requires": {"$ref": "#/$defs/ids"},
|
|
"feature_ids": {"$ref": "#/$defs/ids"},
|
|
"example_id": {"type": "string"},
|
|
"family_id": {"type": "string"},
|
|
"classification": {
|
|
"type": "object", "required": ["relation", "node_ids", "note"], "additionalProperties": false,
|
|
"properties": {
|
|
"relation": {"enum": ["exact", "narrower_than", "component_of", "project_extension"]},
|
|
"node_ids": {"$ref": "#/$defs/ids"},
|
|
"note": {"type": "string", "minLength": 5}
|
|
}
|
|
},
|
|
"parameter_schema": {"type": "object"},
|
|
"derived_properties": {"type": "array", "items": {"type": "object", "required": ["id", "definition", "unit", "formula"], "properties": {"id": {"type": "string"}, "definition": {"type": "string"}, "unit": {"type": "string"}, "formula": {"type": "string"}}, "additionalProperties": false}},
|
|
"params": {"type": "object"},
|
|
"expected_derived": {"type": "object"},
|
|
"sources": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
|
|
},
|
|
"additionalProperties": false,
|
|
"allOf": [
|
|
{"if": {"properties": {"kind": {"const": "family"}}}, "then": {"required": ["name_en", "aliases", "entity_kind", "classification", "feature_ids", "example_id", "parameter_schema", "derived_properties"]}},
|
|
{"if": {"properties": {"kind": {"const": "example"}}}, "then": {"required": ["family_id", "params", "expected_derived"]}}
|
|
],
|
|
"$defs": {"ids": {"type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^[a-z][a-z0-9-]+$"}}}
|
|
}
|