← Files Code Ontology CompanionARCHIVED FILE
skills/manage-code-ontology/references/code-reference.schema.json
6.05 KB · Oct 2, 2026 · 00:29 UTC
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:code-ontology-companion:code-reference:1.0.0",
"title": "Selected Code Ontology reference",
"type": "object",
"additionalProperties": false,
"required": ["profile", "profile_version", "co_namespace", "source_schema_version", "artifact_id", "producer", "scope", "snapshot", "selection", "symbols", "relations", "evidence", "authority"],
"properties": {
"profile": {"const": "code-ontology-reference"},
"profile_version": {"const": "1.0.0"},
"co_namespace": {"const": "https://battle-doll.github.io/code-ontology-explorer/schema#"},
"source_schema_version": {"const": "1.0"},
"artifact_id": {"type": "string", "pattern": "^urn:code-ontology-reference:[a-f0-9]{64}$"},
"producer": {
"type": "object", "additionalProperties": false,
"required": ["name", "version"],
"properties": {"name": {"const": "code-ontology-companion"}, "version": {"type": "string", "maxLength": 160}}
},
"scope": {
"type": "object", "additionalProperties": false,
"required": ["repository_id", "module_id", "module_root"],
"properties": {
"repository_id": {"type": "string", "minLength": 1, "maxLength": 160},
"module_id": {"type": "string", "pattern": "^module:[a-f0-9]{24}$"},
"module_root": {"type": "string", "minLength": 1, "maxLength": 1024}
}
},
"snapshot": {
"type": "object", "additionalProperties": false,
"required": ["id", "repository_revision", "revision_binding", "source_state", "analyzer_version"],
"properties": {
"id": {"type": "string", "minLength": 1, "maxLength": 160},
"repository_revision": {"type": ["string", "null"], "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"},
"revision_binding": {"enum": ["not_checked", "unavailable"]},
"source_state": {"const": "not_checked"},
"analyzer_version": {"type": "string", "minLength": 1, "maxLength": 160}
}
},
"selection": {
"type": "object", "additionalProperties": false,
"required": ["requested_ids", "mode", "omitted_relationships", "whole_repository"],
"properties": {
"requested_ids": {"type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"mode": {"const": "bounded_one_hop"},
"omitted_relationships": {"type": "integer", "minimum": 0},
"whole_repository": {"const": false}
}
},
"symbols": {
"type": "array", "minItems": 1, "maxItems": 100,
"items": {
"type": "object", "additionalProperties": false,
"required": ["id", "reference_id", "kind", "qualified_name", "source", "resolution", "runtime_status", "evidence_refs"],
"properties": {
"id": {"$ref": "#/$defs/id"},
"reference_id": {"type": "string", "pattern": "^symbol:[a-f0-9]{24}$"},
"kind": {"type": "string", "minLength": 1, "maxLength": 160},
"qualified_name": {"type": "string", "minLength": 1, "maxLength": 1024},
"source": {"anyOf": [{"$ref": "#/$defs/source"}, {"type": "null"}]},
"resolution": {"enum": ["source_located", "external", "source_unresolved", "outside_module"]},
"runtime_status": {"const": "runtime_unknown"},
"evidence_refs": {"$ref": "#/$defs/refs"}
}
}
},
"relations": {
"type": "array", "maxItems": 200,
"items": {
"type": "object", "additionalProperties": false,
"required": ["id", "source", "target", "type", "evidence_refs", "resolution"],
"properties": {
"id": {"type": "string", "pattern": "^relation:[a-f0-9]{24}$"},
"source": {"$ref": "#/$defs/id"}, "target": {"$ref": "#/$defs/id"},
"type": {"type": "string", "minLength": 1, "maxLength": 160},
"evidence_refs": {"$ref": "#/$defs/refs"},
"resolution": {"enum": ["evidenced", "evidence_unavailable"]}
}
}
},
"evidence": {
"type": "array", "maxItems": 3300,
"items": {
"type": "object", "additionalProperties": false,
"required": ["id", "origin", "review_status", "locator", "source", "code"],
"properties": {
"id": {"type": "string", "pattern": "^evidence:[a-f0-9]{24}$"},
"origin": {"const": "source_observed"}, "review_status": {"const": "not_assessed"},
"locator": {"type": "string", "minLength": 1, "maxLength": 1100},
"source": {"anyOf": [{"$ref": "#/$defs/source"}, {"type": "null"}]},
"code": {
"type": "object", "additionalProperties": false,
"required": ["rule_id", "basis", "runtime_status", "limitations"],
"properties": {
"rule_id": {"type": "string", "pattern": "^[a-z][a-z0-9_.-]{2,79}$"},
"basis": {"enum": ["direct_syntax", "resolved_static", "framework_semantic", "name_heuristic"]},
"runtime_status": {"enum": ["not_applicable", "runtime_unknown"]},
"limitations": {"type": "array", "maxItems": 32, "items": {"type": "string", "pattern": "^[a-z][a-z0-9_.-]{2,79}$"}}
}
}
}
}
},
"authority": {
"type": "object", "additionalProperties": false,
"required": ["content", "current_authorization", "runtime_behavior", "approval"],
"properties": {"content": {"const": "untrusted_data"}, "current_authorization": {"const": "not_checked"}, "runtime_behavior": {"const": "not_checked"}, "approval": {"const": "not_transferred"}}
}
},
"$defs": {
"id": {"type": "string", "minLength": 1, "maxLength": 512},
"refs": {"type": "array", "maxItems": 16, "uniqueItems": true, "items": {"type": "string", "pattern": "^evidence:[a-f0-9]{24}$"}},
"source": {
"type": "object", "additionalProperties": false,
"required": ["path", "line_start", "line_end"],
"properties": {
"path": {"type": "string", "minLength": 1, "maxLength": 1024},
"line_start": {"type": "integer", "minimum": 1, "maximum": 10000000},
"line_end": {"type": "integer", "minimum": 1, "maximum": 10000000}
}
}
}
}
SHA-256: 33d5e5fc65b730be25c15ed68a4ef51265b8d4681c2c55e8186b87e2b17a1874