-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhypercode-ir-v2.schema.json
More file actions
127 lines (127 loc) · 4.03 KB
/
Copy pathhypercode-ir-v2.schema.json
File metadata and controls
127 lines (127 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://0al-spec.github.io/Hypercode/schema/hypercode-ir-v2.schema.json",
"title": "Hypercode IR v2",
"description": "Hypercode resolved-graph IR v2: typed values, cascade trace (winner + losers), per-node SHA-256 hashes, context echo, resolver metadata, and accumulated selector contracts (HC-111).",
"type": "object",
"required": ["version", "context", "resolver", "documentHash", "nodes"],
"additionalProperties": false,
"properties": {
"version": {
"type": "string",
"const": "hypercode.ir/v2"
},
"context": {
"type": "object",
"description": "Echo of the --ctx flags supplied at resolution time.",
"additionalProperties": { "type": "string" }
},
"resolver": {
"type": "object",
"required": ["name", "version"],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"version": { "type": "string" }
}
},
"documentHash": {
"type": "string",
"description": "SHA-256 of newline-joined root-node hashes (document-level fingerprint).",
"pattern": "^[0-9a-f]{64}$"
},
"nodes": {
"type": "array",
"items": { "$ref": "#/$defs/resolvedNode" }
}
},
"$defs": {
"resolvedNode": {
"type": "object",
"required": ["type", "hash", "properties", "children"],
"additionalProperties": false,
"properties": {
"type": { "type": "string" },
"class": { "type": "string" },
"id": { "type": "string" },
"hash": {
"type": "string",
"description": "SHA-256 of the node's stable content (type, class?, id?, resolved values, child hashes).",
"pattern": "^[0-9a-f]{64}$"
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#/$defs/resolvedProperty" }
},
"children": {
"type": "array",
"items": { "$ref": "#/$defs/resolvedNode" }
}
}
},
"resolvedProperty": {
"type": "object",
"required": ["value", "winner", "losers", "contracts"],
"additionalProperties": false,
"properties": {
"value": {
"description": "The winning resolved value (typed).",
"anyOf": [
{ "type": "string" },
{ "type": "integer" },
{ "type": "number" },
{ "type": "boolean" }
]
},
"winner": { "$ref": "#/$defs/matchEntry" },
"losers": {
"type": "array",
"items": { "$ref": "#/$defs/matchEntry" }
},
"contracts": {
"type": "array",
"description": "Contracts governing this property (HC-111), ascending specificity — narrowest last. Empty when no @contract: block matches the node.",
"items": { "$ref": "#/$defs/contractEntry" }
}
}
},
"matchEntry": {
"type": "object",
"required": ["selector", "specificity", "order", "line", "value"],
"additionalProperties": false,
"properties": {
"selector": { "type": "string" },
"specificity": {
"type": "array",
"description": "[ids, classes, types]",
"items": { "type": "integer" },
"minItems": 3,
"maxItems": 3
},
"order": { "type": "integer" },
"line": { "type": "integer" },
"file": { "type": "string" },
"value": {
"anyOf": [
{ "type": "string" },
{ "type": "integer" },
{ "type": "number" },
{ "type": "boolean" }
]
}
}
},
"contractEntry": {
"type": "object",
"required": ["selector", "type", "required"],
"additionalProperties": false,
"properties": {
"selector": { "type": "string" },
"type": { "type": "string", "enum": ["string", "int", "float", "bool"] },
"required": { "type": "boolean" },
"min": { "type": "number" },
"max": { "type": "number" }
}
}
}
}