Skip to content

Commit a41983e

Browse files
committed
feat: add json schema for the standard registry
1 parent 2d3ee4b commit a41983e

File tree

1 file changed

+191
-0
lines changed

1 file changed

+191
-0
lines changed

registry.schema.json

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://raw.githubusercontent.com/divnix/std/main/registry.schema.json",
4+
"title": "Standard Registry",
5+
"description": "The json schema to be found when serializing .#__std of a Standardized repository with Nix to json.",
6+
"type": "object",
7+
"additionalProperties": true,
8+
"properties": {
9+
"__schema": {
10+
"title": "Schema Version",
11+
"description": "The Standard Registry schema version.",
12+
"const": "v0"
13+
},
14+
"cellsFrom": {
15+
"title": "Cell Root Path",
16+
"description": "Relative path to the repository root from which cells are discovered.",
17+
"type": "string"
18+
},
19+
"ci": { "$ref": "#/definitions/ci" },
20+
"ci'": { "$ref": "#/definitions/ci-prime" },
21+
"init": { "$ref": "#/definitions/init" },
22+
"actions": { "$ref": "#/definitions/actions" }
23+
},
24+
"required": ["__schema", "ci", "ci'", "init", "actions", "cellsFrom"],
25+
26+
"$defs": {
27+
"ci-task": {
28+
"title": "CI Task w/o Drvs",
29+
"description": "A representation of a CI task's metadata.",
30+
"type": "object",
31+
"properties": {
32+
"action": {
33+
"type": "string",
34+
"description": "The name of the action."
35+
},
36+
"actionFragment": {
37+
"type": "string",
38+
"description": "The flake fragment where to find the action derivation."
39+
},
40+
"block": { "type": "string", "description": "The block name." },
41+
"blockType": { "type": "string", "description": "The block type." },
42+
"cell": { "type": "string", "description": "The cell name." },
43+
"name": { "type": "string", "description": "The target name." },
44+
"targetFragment": {
45+
"type": "string",
46+
"description": "The flake fragment where to find the target."
47+
}
48+
},
49+
"required": [
50+
"action",
51+
"actionFragment",
52+
"block",
53+
"blockType",
54+
"cell",
55+
"name",
56+
"targetFragment"
57+
]
58+
},
59+
"ci-task-prime": {}
60+
},
61+
62+
"definitions": {
63+
"actions": {
64+
"title": "Actions",
65+
"description": "The Actions collection's runnable derivations. They house derivations. Since building these derivations may be expensive, they are housed in a separate namespace that can be accessed on demand by a caller.",
66+
"type": "object",
67+
"additionalProperties": {
68+
"title": "System",
69+
"description": "Actions are namespaced per system as a derviation is only valid for its specified system.",
70+
"type": "object",
71+
"additionalProperties": {
72+
"title": "Cell",
73+
"description": "The cell namespace for actions.",
74+
"type": "object",
75+
"additionalProperties": {
76+
"title": "Block",
77+
"description": "The block namespace for actions.",
78+
"type": "object",
79+
"additionalProperties": {
80+
"title": "Target",
81+
"description": "The target namespace for actions.",
82+
"type": "object",
83+
"additionalProperties": {
84+
"title": "Action",
85+
"description": "The string reperesentation of a realized store path that points to a runnable which implements the action.",
86+
"type": "string"
87+
}
88+
}
89+
}
90+
}
91+
}
92+
},
93+
"init": {
94+
"title": "Init",
95+
"description": "The representational metadata about the Standardized repository.",
96+
"type": "array",
97+
"items": {
98+
"title": "Cell",
99+
"description": "The representational data of a cell.",
100+
"type": "object",
101+
"required": ["cell", "cellBlocks"],
102+
"properties": {
103+
"cell": { "type": "string" },
104+
"cellBlocks": {
105+
"type": "array",
106+
"items": {
107+
"title": "Block",
108+
"description": "The representational data of a block.",
109+
"type": "object",
110+
"required": ["blockType", "cellBlock", "targets"],
111+
"properties": {
112+
"blockType": { "type": "string" },
113+
"cellBlock": { "type": "string" },
114+
"targets": {
115+
"type": "array",
116+
"items": {
117+
"title": "Target",
118+
"description": "The representational data of a target.",
119+
"type": "object",
120+
"required": ["name", "actions"],
121+
"properties": {
122+
"name": { "type": "string" },
123+
"actions": {
124+
"type": "array",
125+
"items": {
126+
"title": "Action",
127+
"description": "The representational data of an action (w/o derivation).",
128+
"type": "object",
129+
"properties": {
130+
"name": { "type": "string" },
131+
"description": { "type": "string" }
132+
}
133+
}
134+
}
135+
}
136+
}
137+
}
138+
}
139+
}
140+
}
141+
}
142+
}
143+
},
144+
"ci": {
145+
"title": "CI w/o Drvs",
146+
"description": "A cheap evaluation that provides all necessary metadata without evaluating any derivations.",
147+
"type": "object",
148+
"additionalProperties": {
149+
"title": "System",
150+
"type": "array",
151+
"items": { "$ref": "#/$defs/ci-task" }
152+
}
153+
},
154+
"ci-prime": {
155+
"title": "CI w/ Drvs",
156+
"description": "An expensive evaluation that provides all necessary metadata including evaluated derivations.",
157+
"type": "object",
158+
"additionalProperties": {
159+
"title": "System",
160+
"type": "array",
161+
"items": {
162+
"title": "CI Task w/ Drvs",
163+
"description": "A representation of a CI task that includes evaluated derviations.",
164+
"allOf": [
165+
{ "$ref": "#/$defs/ci-task" },
166+
{
167+
"type": "object",
168+
"title": "Drvs extension",
169+
"description": "The expensive-to-evaluate derivations.",
170+
"properties": {
171+
"actionDrv": {
172+
"type": "string",
173+
"description": "The evaluated derivation for the action runnable."
174+
},
175+
"targetDrv": {
176+
"type": "string",
177+
"description": "The evaluated derivation for the target (if target is a derivation)."
178+
},
179+
"proviso": {
180+
"type": "string",
181+
"description": "A provisio which lets a CI cheaply decide whether running an action can be skipped."
182+
}
183+
},
184+
"required": ["actionDrv"]
185+
}
186+
]
187+
}
188+
}
189+
}
190+
}
191+
}

0 commit comments

Comments
 (0)