forked from omelkonian/agda-dependencies
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgraph-v2-expanded.schema.json
More file actions
233 lines (233 loc) · 9.17 KB
/
Copy pathgraph-v2-expanded.schema.json
File metadata and controls
233 lines (233 loc) · 9.17 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/input-output-hk/agda-dependencies/blob/main/schema/graph-v2-expanded.schema.json",
"title": "agda-deps v2 graph.json (expanded mode)",
"description": "Wire schema for the JSON that `agda-deps --format=json --json-mode=expanded` emits. The producer encoder `AgdaDeps.Backend.GraphJson.buildExpandedJson` remains the single source of truth; this file is generated to match it and CI validates freshly-generated expanded output against it. `required` lists the fields the producer has emitted since v2 inception; fields added later (and documented as additive in CLAUDE.md) are optional, so this schema validates both current and older v2 output. `additionalProperties` is `true` throughout: downstream readers ignore unknown fields, and a future additive field must not fail v2 validation. The `packed` mode (CSR + base64 typed arrays) and the `--lazy` split-file layout are NOT covered here.",
"type": "object",
"additionalProperties": true,
"required": [
"v",
"schemaVersion",
"mode",
"modules",
"entryModule",
"externalModules",
"failedModules",
"definitions",
"definitionEdges",
"moduleEdges",
"transitiveModuleEdges",
"moduleFiles",
"sourceFiles",
"reexports"
],
"properties": {
"v": {
"const": 2,
"description": "Wire-shape version. A consumer must refuse a `v` it doesn't recognise."
},
"schemaVersion": {
"const": 2,
"description": "Expanded-form schema version (mirrors `v` for the expanded shape)."
},
"mode": {
"const": "expanded",
"description": "Discriminates expanded from packed output."
},
"nodeKeyVersion": {
"type": "integer",
"minimum": 1,
"description": "Additive. Node-naming convention version (orthogonal to the schema version). Absent in older JSON, where a reader assumes 1. Lets a downstream reader spot a stale-format cache."
},
"producer": {
"type": "string",
"description": "Additive. Build fingerprint of the emitting agda-deps, e.g. \"agda-deps 1.1 (git <sha>+, built <date>, ghc 9.14)\"."
},
"modules": {
"type": "array",
"items": { "type": "string" },
"description": "All module names referenced in the graph (definitions' modules, import-edge endpoints, the entry, failed and extra modules)."
},
"entryModule": {
"type": ["string", "null"],
"description": "The IsMain entry module, or null when unknown."
},
"externalModules": {
"type": "array",
"items": { "type": "string" },
"description": "Modules classified as external (outside the project root)."
},
"failedModules": {
"type": "array",
"items": { "type": "string" },
"description": "Modules whose type-check raised under --keep-going (each gets an `F`-state marker node)."
},
"definitions": {
"type": "array",
"items": { "$ref": "#/$defs/definition" }
},
"definitionEdges": {
"type": "array",
"items": { "$ref": "#/$defs/edge" },
"description": "Leaf dependency edges as [sourceName, targetName] pairs, keyed by `definition.name`."
},
"definitionEdgesProvenance": {
"type": "array",
"items": { "$ref": "#/$defs/provenance" },
"description": "Additive (round 4). Parallel to `definitionEdges`: index i tags how edge i was discovered. When present, MUST be the same length as `definitionEdges` (a cross-array invariant this schema cannot express; the consumer enforces it). Absent in older JSON, where every edge is treated as \"unknown\"."
},
"moduleEdges": {
"type": "array",
"items": { "$ref": "#/$defs/edge" },
"description": "Module-level edges as [sourceModule, targetModule] pairs (leaf edges lifted to modules, unioned with import edges)."
},
"transitiveModuleEdges": {
"type": "array",
"items": { "$ref": "#/$defs/edge" },
"description": "Transitive closure of `moduleEdges` as [sourceModule, targetModule] pairs."
},
"moduleFiles": {
"type": "object",
"additionalProperties": { "type": "string" },
"description": "Map from module name to its source file path."
},
"sourceFiles": {
"type": "array",
"items": { "type": "string" },
"description": "Source file paths discovered by the scan."
},
"reexports": {
"type": "array",
"items": { "$ref": "#/$defs/reexport" },
"description": "Public re-export rows (`open import M public`)."
},
"definitionSubtermHashes": {
"type": "array",
"items": {
"type": "array",
"items": { "type": "integer", "minimum": 0 }
},
"description": "Additive (round 6, --with-term-hashes). Parallel to `definitions`: index i is that def's array of canonical-subterm Word64 fingerprints (emitted as JSON numbers). When present, MUST be the same length as `definitions`."
},
"definitionSubtermDepths": {
"type": "array",
"items": {
"type": "array",
"items": { "type": "integer", "minimum": 0 }
},
"description": "Additive (round 6, --with-term-hashes). Parallel to `definitionSubtermHashes`: the AST depth of each emitted subterm. Same length contract."
},
"externals_summary": {
"$ref": "#/$defs/externalsSummary",
"description": "Additive (--no-externals). Diagnostic record of the externals stripped from the graph; absent otherwise."
}
},
"$defs": {
"edge": {
"type": "array",
"items": { "type": "string" },
"minItems": 2,
"maxItems": 2,
"description": "A directed edge encoded as a two-element [source, target] array of wire names."
},
"state": {
"type": "string",
"enum": ["D", "P", "H", "F"],
"description": "Definition lifecycle: Defined / Postulate / Hole / Failed."
},
"kind": {
"type": "string",
"enum": [
"function",
"projection",
"datatype",
"record",
"constructor",
"postulate",
"primitive",
"other"
],
"description": "Structural kind. `other` covers external library references with no local definition."
},
"access": {
"type": "string",
"enum": ["private", "public"],
"description": "Defining-module visibility. Absent in the JSON means `public`."
},
"provenance": {
"type": "string",
"enum": ["signature", "body", "module-local", "with", "unknown"],
"description": "How an edge was discovered: defType (signature), theDef body, anonymous-module-local helper (where-block helper or parameterised-section member; does not imply ownership by this source), with-auxiliary, or unclassified."
},
"definition": {
"type": "object",
"additionalProperties": true,
"required": ["id", "name", "module", "state", "kind", "x", "y"],
"properties": {
"id": {
"type": "integer",
"description": "Index into `definitions` (sorted by node-key hash). -1 for references with no local definition."
},
"name": {
"type": "string",
"description": "Canonical wire name (`nodeKey`): prettyShow plus an @<binding-line> suffix for `._.` helpers. Edge endpoints key on this."
},
"module": { "type": "string" },
"state": { "$ref": "#/$defs/state" },
"kind": { "$ref": "#/$defs/kind" },
"line": {
"type": "integer",
"minimum": 1,
"description": "Additive/optional. 1-based start line; absent when the producer didn't know."
},
"access": { "$ref": "#/$defs/access" },
"type": {
"type": "string",
"description": "Additive/optional (--with-signatures). Reified type signature, as-written (not normalised), collapsed to one line."
},
"x": {
"type": ["number", "null"],
"description": "Layout x position, or null when no layout was computed."
},
"y": {
"type": ["number", "null"],
"description": "Layout y position, or null when no layout was computed."
}
}
},
"reexport": {
"type": "object",
"additionalProperties": true,
"required": ["from", "to", "names"],
"properties": {
"from": { "type": "string", "description": "Host module doing `open import M public`." },
"to": { "type": "string", "description": "Source module M." },
"names": {
"type": "array",
"items": { "type": "string" },
"description": "Fully-qualified names flowing through (match `definition.name`)."
}
}
},
"externalsSummary": {
"type": "object",
"additionalProperties": true,
"required": ["modules", "postulates_by_module"],
"properties": {
"modules": {
"type": "array",
"items": { "type": "string" },
"description": "Module names that were dropped."
},
"postulates_by_module": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": { "type": "string" }
},
"description": "Per dropped module, the unqualified postulate names it held."
}
}
}
}
}