Skill Tracer
Skills › Archify › archify › erd.schema.json

erd.schema.json

381 lines · archify/schemas/erd.schema.json at a406594

1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "$id": "https://github.com/tt-a1i/archify/schemas/erd.schema.json",
4 "title": "Archify Entity-Relationship Diagram",
5 "type": "object",
6 "additionalProperties": false,
7 "required": [
8 "schema_version",
9 "diagram_type",
10 "meta",
11 "entities"
12 ],
13 "properties": {
14 "schema_version": {
15 "const": 1
16 },
17 "diagram_type": {
18 "const": "erd"
19 },
20 "meta": {
21 "type": "object",
22 "additionalProperties": false,
23 "required": [
24 "title"
25 ],
26 "properties": {
27 "title": {
28 "type": "string",
29 "minLength": 1
30 },
31 "locale": {
32 "$ref": "common.schema.json#/$defs/locale"
33 },
34 "translations": {
35 "$ref": "common.schema.json#/$defs/translations"
36 },
37 "subtitle": {
38 "type": "string"
39 },
40 "output": {
41 "type": "string"
42 },
43 "animation": {
44 "$ref": "common.schema.json#/$defs/animation"
45 },
46 "visual_preset": {
47 "$ref": "common.schema.json#/$defs/visualPreset"
48 },
49 "quality_profile": {
50 "$ref": "common.schema.json#/$defs/qualityProfile"
51 },
52 "repository": {
53 "$ref": "common.schema.json#/$defs/repository"
54 },
55 "views": {
56 "$ref": "common.schema.json#/$defs/guidedViews"
57 },
58 "legend": {
59 "type": "object",
60 "additionalProperties": false,
61 "properties": {
62 "mode": {
63 "$ref": "common.schema.json#/$defs/legendMode"
64 },
65 "entries": {
66 "type": "object",
67 "additionalProperties": false,
68 "properties": {
69 "pk": {
70 "$ref": "common.schema.json#/$defs/legendEntry"
71 },
72 "fk": {
73 "$ref": "common.schema.json#/$defs/legendEntry"
74 },
75 "uk": {
76 "$ref": "common.schema.json#/$defs/legendEntry"
77 },
78 "one": {
79 "$ref": "common.schema.json#/$defs/legendEntry"
80 },
81 "many": {
82 "$ref": "common.schema.json#/$defs/legendEntry"
83 },
84 "optional": {
85 "$ref": "common.schema.json#/$defs/legendEntry"
86 }
87 }
88 }
89 }
90 },
91 "viewBox": {
92 "type": "array",
93 "prefixItems": [
94 {
95 "type": "number",
96 "minimum": 320
97 },
98 {
99 "type": "number",
100 "minimum": 240
101 }
102 ],
103 "items": false,
104 "minItems": 2,
105 "maxItems": 2
106 }
107 }
108 },
109 "layout": {
110 "type": "object",
111 "additionalProperties": false,
112 "required": [
113 "mode"
114 ],
115 "properties": {
116 "mode": {
117 "enum": [
118 "grid"
119 ]
120 },
121 "origin": {
122 "$ref": "common.schema.json#/$defs/point"
123 },
124 "gapX": {
125 "type": "number",
126 "minimum": 0
127 },
128 "gapY": {
129 "type": "number",
130 "minimum": 0
131 },
132 "entityW": {
133 "type": "number",
134 "minimum": 80
135 },
136 "headerH": {
137 "type": "number",
138 "minimum": 16
139 },
140 "rowH": {
141 "type": "number",
142 "minimum": 10
143 }
144 }
145 },
146 "entities": {
147 "type": "array",
148 "minItems": 1,
149 "items": {
150 "type": "object",
151 "additionalProperties": false,
152 "required": [
153 "id",
154 "label"
155 ],
156 "properties": {
157 "id": {
158 "$ref": "common.schema.json#/$defs/id"
159 },
160 "label": {
161 "type": "string",
162 "minLength": 1
163 },
164 "sublabel": {
165 "type": "string"
166 },
167 "tag": {
168 "type": "string"
169 },
170 "row": {
171 "type": "integer",
172 "minimum": 0,
173 "maximum": 12
174 },
175 "col": {
176 "type": "integer",
177 "minimum": 0,
178 "maximum": 12
179 },
180 "pos": {
181 "$ref": "common.schema.json#/$defs/point"
182 },
183 "width": {
184 "type": "number",
185 "minimum": 80
186 },
187 "attributes": {
188 "type": "array",
189 "items": {
190 "type": "object",
191 "additionalProperties": false,
192 "required": [
193 "name"
194 ],
195 "properties": {
196 "name": {
197 "type": "string",
198 "minLength": 1
199 },
200 "type": {
201 "type": "string"
202 },
203 "key": {
204 "anyOf": [
205 {
206 "enum": [
207 "pk",
208 "fk",
209 "uk"
210 ]
211 },
212 {
213 "type": "array",
214 "minItems": 1,
215 "items": {
216 "enum": [
217 "pk",
218 "fk",
219 "uk"
220 ]
221 }
222 }
223 ]
224 },
225 "references": {
226 "type": "string",
227 "minLength": 3,
228 "pattern": "^[^.]+\\.[^.]+$"
229 }
230 },
231 "if": {
232 "properties": {
233 "key": {
234 "anyOf": [
235 {
236 "const": "fk"
237 },
238 {
239 "type": "array",
240 "contains": {
241 "const": "fk"
242 }
243 }
244 ]
245 }
246 },
247 "required": [
248 "key"
249 ]
250 },
251 "then": {
252 "required": [
253 "references"
254 ],
255 "properties": {
256 "references": {}
257 }
258 }
259 }
260 },
261 "sources": {
262 "$ref": "common.schema.json#/$defs/sourceReferences"
263 }
264 }
265 }
266 },
267 "relationships": {
268 "type": "array",
269 "items": {
270 "type": "object",
271 "additionalProperties": false,
272 "required": [
273 "from",
274 "to",
275 "fromCardinality",
276 "toCardinality"
277 ],
278 "properties": {
279 "id": {
280 "$ref": "common.schema.json#/$defs/id"
281 },
282 "from": {
283 "$ref": "common.schema.json#/$defs/id"
284 },
285 "to": {
286 "$ref": "common.schema.json#/$defs/id"
287 },
288 "label": {
289 "type": "string"
290 },
291 "fromCardinality": {
292 "enum": [
293 "one",
294 "many"
295 ]
296 },
297 "toCardinality": {
298 "enum": [
299 "one",
300 "many"
301 ]
302 },
303 "fromOptional": {
304 "type": "boolean"
305 },
306 "toOptional": {
307 "type": "boolean"
308 },
309 "identifying": {
310 "type": "boolean"
311 },
312 "variant": {
313 "$ref": "common.schema.json#/$defs/variant"
314 },
315 "fromSide": {
316 "$ref": "common.schema.json#/$defs/side"
317 },
318 "toSide": {
319 "$ref": "common.schema.json#/$defs/side"
320 },
321 "route": {
322 "enum": [
323 "auto",
324 "straight",
325 "orthogonal-h",
326 "orthogonal-v"
327 ]
328 },
329 "via": {
330 "type": "array",
331 "items": {
332 "$ref": "common.schema.json#/$defs/point"
333 }
334 },
335 "labelAt": {
336 "$ref": "common.schema.json#/$defs/point"
337 },
338 "labelDx": {
339 "type": "number"
340 },
341 "labelDy": {
342 "type": "number"
343 },
344 "labelSegment": {
345 "type": "integer",
346 "minimum": 0
347 },
348 "width": {
349 "$ref": "common.schema.json#/$defs/relationshipWidth"
350 }
351 },
352 "allOf": [
353 {
354 "if": {
355 "required": [
356 "identifying"
357 ],
358 "properties": {
359 "identifying": {
360 "const": false
361 }
362 }
363 },
364 "then": {
365 "properties": {
366 "variant": {
367 "enum": [
368 "dashed"
369 ]
370 }
371 }
372 }
373 }
374 ]
375 }
376 },
377 "cards": {
378 "$ref": "common.schema.json#/$defs/cards"
379 }
380 }