Skip to content

Commit 0b9ab30

Browse files
authored
First version of the JSON schemas for system/storage and proposal/storage (#2852)
Includes the schema files (generated manually) and the corresponding javascript type definitions (generated via `json2ts`). This replaces joseivanlopez#14 (which was targeting another fork).
2 parents 73cf50a + f978ce3 commit 0b9ab30

File tree

5 files changed

+673
-0
lines changed

5 files changed

+673
-0
lines changed
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
3+
"$id": "https://github.com/openSUSE/agama/blob/master/rust/share/device.storage.schema.json",
4+
"title": "Storage device",
5+
"description": "Schema to describe a device both in 'system' and 'proposal'.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"required": ["sid", "name"],
9+
"properties": {
10+
"sid": { "type": "integer" },
11+
"name": { "type": "string" },
12+
"description": { "type": "string" },
13+
"block": { "$ref": "#/$defs/block" },
14+
"drive": { "$ref": "#/$defs/drive" },
15+
"filesystem": { "$ref": "#/$defs/filesystem" },
16+
"md": { "$ref": "#/$defs/md" },
17+
"multipath": { "$ref": "#/$defs/multipath" },
18+
"partitionTable": { "$ref": "#/$defs/partitionTable" },
19+
"partition": { "$ref": "#/$defs/partition" },
20+
"partitions": {
21+
"type": "array",
22+
"items": { "$ref": "#" }
23+
},
24+
"volumeGroup": { "$ref": "#/$defs/volumeGroup" },
25+
"logicalVolumes": {
26+
"type": "array",
27+
"items": { "$ref": "#" }
28+
}
29+
},
30+
"$defs": {
31+
"block": {
32+
"type": "object",
33+
"additionalProperties": false,
34+
"required": ["start", "size", "shrinking"],
35+
"properties": {
36+
"start": { "type": "integer" },
37+
"size": { "type": "integer" },
38+
"active": { "type": "boolean" },
39+
"encrypted": { "type": "boolean" },
40+
"udevIds": {
41+
"type": "array",
42+
"items": { "type": "string" }
43+
},
44+
"udevPaths": {
45+
"type": "array",
46+
"items": { "type": "string" }
47+
},
48+
"systems": {
49+
"type": "array",
50+
"items": { "type": "string" }
51+
},
52+
"shrinking": {
53+
"anyOf": [
54+
{ "$ref": "#/$defs/shrinkingSupported" },
55+
{ "$ref": "#/$defs/shrinkingUnsupported" }
56+
]
57+
}
58+
}
59+
},
60+
"shrinkingSupported": {
61+
"type": "object",
62+
"additionalProperties": false,
63+
"properties": {
64+
"supported": { "type": "integer" }
65+
}
66+
},
67+
"shrinkingUnsupported": {
68+
"type": "object",
69+
"additionalProperties": false,
70+
"properties": {
71+
"unsupported": {
72+
"type": "array",
73+
"items": { "type": "string" }
74+
}
75+
}
76+
},
77+
"drive": {
78+
"type": "object",
79+
"additionalProperties": false,
80+
"properties": {
81+
"type": { "enum": ["disk", "raid", "multipath", "dasd"] },
82+
"vendor": { "type": "string" },
83+
"model": { "type": "string" },
84+
"transport": { "type": "string" },
85+
"bus": { "type": "string" },
86+
"busId": { "type": "string" },
87+
"driver": {
88+
"type": "array",
89+
"items": { "type": "string" }
90+
},
91+
"info": { "$ref": "#/$defs/driveInfo" }
92+
}
93+
},
94+
"driveInfo": {
95+
"type": "object",
96+
"additionalProperties": false,
97+
"properties": {
98+
"sdCard": { "type": "boolean" },
99+
"dellBoss": { "type": "boolean" }
100+
}
101+
},
102+
"filesystem": {
103+
"type": "object",
104+
"additionalProperties": false,
105+
"required": ["sid", "type"],
106+
"properties": {
107+
"sid": { "type": "integer" },
108+
"type": { "$ref": "#/$defs/filesystemType" },
109+
"mountPath": { "type": "string" },
110+
"label": { "type": "string" }
111+
}
112+
},
113+
"filesystemType": {
114+
"enum": [
115+
"bcachefs",
116+
"btrfs",
117+
"exfat",
118+
"ext2",
119+
"ext3",
120+
"ext4",
121+
"f2fs",
122+
"jfs",
123+
"nfs",
124+
"nilfs2",
125+
"ntfs",
126+
"reiserfs",
127+
"swap",
128+
"tmpfs",
129+
"vfat",
130+
"xfs"
131+
]
132+
},
133+
"md": {
134+
"type": "object",
135+
"additionalProperties": false,
136+
"required": ["level", "devices"],
137+
"properties": {
138+
"level": { "$ref": "#/$defs/mdRaidLevel" },
139+
"devices": {
140+
"type": "array",
141+
"items": { "type": "integer" }
142+
},
143+
"uuid": { "type": "string" }
144+
}
145+
},
146+
"mdRaidLevel": {
147+
"title": "MD level",
148+
"enum": [
149+
"raid0",
150+
"raid1",
151+
"raid5",
152+
"raid6",
153+
"raid10"
154+
]
155+
},
156+
"multipath": {
157+
"type": "object",
158+
"additionalProperties": false,
159+
"required": ["wireNames"],
160+
"properties": {
161+
"wireNames": {
162+
"type": "array",
163+
"items": { "type": "string" }
164+
}
165+
}
166+
},
167+
"partitionTable": {
168+
"type": "object",
169+
"additionalProperties": false,
170+
"required": ["type", "unusedSlots"],
171+
"properties": {
172+
"type": { "$ref": "#/$defs/ptableType" },
173+
"unusedSlots": {
174+
"type": "array",
175+
"items": {
176+
"type": "array",
177+
"items": { "type": "integer" }
178+
}
179+
}
180+
}
181+
},
182+
"ptableType": {
183+
"enum": ["gpt", "msdos", "dasd"]
184+
},
185+
"partition": {
186+
"type": "object",
187+
"additionalProperties": false,
188+
"required": ["efi"],
189+
"properties": {
190+
"efi": { "type": "boolean" }
191+
}
192+
},
193+
"volumeGroup": {
194+
"type": "object",
195+
"additionalProperties": false,
196+
"required": ["size", "physicalVolumes"],
197+
"properties": {
198+
"size": { "type": "integer" },
199+
"physicalVolumes": {
200+
"type": "array",
201+
"items": { "type": "integer" }
202+
}
203+
}
204+
}
205+
}
206+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
3+
"$id": "https://github.com/openSUSE/agama/blob/master/rust/share/proposal.storage.schema.json",
4+
"title": "Proposal",
5+
"description": "API description of the storage proposal.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"properties": {
9+
"devices": {
10+
"description": "Expected layout of the system after the commit phase.",
11+
"type": "array",
12+
"items": { "$ref": "device.storage.schema.json" }
13+
},
14+
"actions": {
15+
"description": "Sorted list of actions to execute during the commit phase.",
16+
"type": "array",
17+
"items": { "$ref": "#/$defs/action" }
18+
}
19+
},
20+
"$defs": {
21+
"action": {
22+
"type": "object",
23+
"additionalProperties": false,
24+
"required": ["device", "text"],
25+
"properties": {
26+
"device": { "type": "integer" },
27+
"text": { "type": "string" },
28+
"subvol": { "type": "boolean" },
29+
"delete": { "type": "boolean" },
30+
"resize": { "type": "boolean" }
31+
}
32+
}
33+
}
34+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
3+
"$id": "https://github.com/openSUSE/agama/blob/master/rust/share/system.storage.schema.json",
4+
"title": "System",
5+
"description": "API description of the system",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"properties": {
9+
"devices": {
10+
"description": "All relevant devices on the system",
11+
"type": "array",
12+
"items": { "$ref": "device.storage.schema.json" }
13+
},
14+
"availableDrives": {
15+
"description": "SIDs of the available drives",
16+
"type": "array",
17+
"items": { "type": "integer" }
18+
},
19+
"availableMdRaids": {
20+
"description": "SIDs of the available MD RAIDs",
21+
"type": "array",
22+
"items": { "type": "integer" }
23+
},
24+
"candidateDrives": {
25+
"description": "SIDs of the drives that are candidate for installation",
26+
"type": "array",
27+
"items": { "type": "integer" }
28+
},
29+
"candidateMdRaids": {
30+
"description": "SIDs of the MD RAIDs that are candidate for installation",
31+
"type": "array",
32+
"items": { "type": "integer" }
33+
},
34+
"productMountPoints": {
35+
"description": "Meaningful mount points for the current product",
36+
"type": "array",
37+
"items": { "type": "string" }
38+
},
39+
"encryptionMethods": {
40+
"description": "Possible encryption methods for the current system and product",
41+
"type": "array",
42+
"items": {
43+
"enum": [
44+
"luks1", "luks2", "pervasiveLuks2", "tmpFde", "protectedSwap", "secureSwap", "randomSwap"
45+
]
46+
}
47+
},
48+
"volumeTemplates": {
49+
"description": "Volumes defined by the product as templates",
50+
"type": "array",
51+
"items": { "$ref": "#/$defs/volume" }
52+
},
53+
"issues": {
54+
"type": "array",
55+
"items": { "$ref": "#/$defs/issue" }
56+
}
57+
},
58+
"$defs": {
59+
"volume": {
60+
"type": "object",
61+
"additionalProperties": false,
62+
"required": ["mountPath", "minSize", "autoSize"],
63+
"properties": {
64+
"mountPath": { "type": "string" },
65+
"mountOptions": {
66+
"type": "array",
67+
"items": { "type": "string" }
68+
},
69+
"fsType": { "$ref": "device.storage.schema.json#/$defs/filesystemType" },
70+
"autoSize": { "type": "boolean" },
71+
"minSize": { "type": "integer" },
72+
"maxSize": { "type": "integer" },
73+
"snapshots": { "type": "boolean" },
74+
"transactional": { "type": "boolean" },
75+
"outline": { "$ref": "#/$defs/volumeOutline" }
76+
}
77+
},
78+
"volumeOutline": {
79+
"type": "object",
80+
"additionalProperties": false,
81+
"required": ["required", "supportAutoSize"],
82+
"properties": {
83+
"required": { "type": "boolean" },
84+
"supportAutoSize": { "type": "boolean" },
85+
"fsTypes": {
86+
"type": "array",
87+
"items": { "$ref": "device.storage.schema.json#/$defs/filesystemType" }
88+
},
89+
"adjustByRam": { "type": "boolean" },
90+
"snapshotsConfigurable": { "type": "boolean" },
91+
"snapshotsAffectSizes": { "type": "boolean" },
92+
"sizeRelevantVolumes": {
93+
"type": "array",
94+
"items": { "type": "string" }
95+
}
96+
}
97+
},
98+
"issue": {
99+
"type": "object",
100+
"additionalProperties": false,
101+
"required": ["description"],
102+
"properties": {
103+
"description": { "type": "string" },
104+
"class": { "type": "string" },
105+
"details": { "type": "string" },
106+
"source": { "enum": ["config", "system"] },
107+
"severity": { "enum": ["warn", "error"] }
108+
}
109+
}
110+
}
111+
}

0 commit comments

Comments
 (0)