-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
kdl-schema.kdl
376 lines (376 loc) · 17.8 KB
/
kdl-schema.kdl
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
document {
info {
title "KDL Schema" lang=en
description "KDL Schema KDL schema in KDL" lang=en
author "Kat Marchán" {
link "https://github.com/zkat" rel=self
}
contributor "Lars Willighagen" {
link "https://github.com/larsgw" rel=self
}
link "https://github.com/zkat/kdl" rel=documentation
license "Creative Commons Attribution-ShareAlike 4.0 International License" spdx=CC-BY-SA-4.0 {
link "https://creativecommons.org/licenses/by-sa/4.0/" lang=en
}
published "2021-08-31"
modified "2021-09-01"
}
node document {
min 1
max 1
children id=node-children {
node node-names id=node-names-node description="Validations to apply specifically to arbitrary node names" {
children ref=#"[id="validations"]"#
}
node other-nodes-allowed id=other-nodes-allowed-node description="Whether to allow child nodes other than the ones explicitly listed. Defaults to '#false'." {
max 1
value {
min 1
max 1
type boolean
}
}
node tag-names description="Validations to apply specifically to arbitrary type tag names" {
children ref=#"[id="validations"]"#
}
node other-tags-allowed description="Whether to allow child node tags other than the ones explicitly listed. Defaults to '#false'." {
max 1
value {
min 1
max 1
type boolean
}
}
node info description="A child node that describes the schema itself." {
children {
node title description="The title of the schema or the format it describes" {
value description="The title text" {
type string
min 1
max 1
}
prop lang id=info-lang description="The language of the text" {
type string
}
}
node description description="A description of the schema or the format it describes" {
value description="The description text" {
type string
min 1
max 1
}
prop ref=#"[id="info-lang"]"#
}
node author description="Author of the schema" {
value id=info-person-name description="Person name" {
type string
min 1
max 1
}
prop orcid id=info-orcid description="The ORCID of the person" {
type string
pattern #"\d{4}-\d{4}-\d{4}-\d{4}"#
}
children {
node ref=#"[id="info-link"]"#
}
}
node contributor description="Contributor to the schema" {
value ref=#"[id="info-person-name"]"#
prop ref=#"[id="info-orcid"]"#
children {
node ref=#"[id="info-link"]"#
}
}
node link id=info-link description="Links to itself, and to sources describing it" {
value description="A URL that the link points to" {
type string
format url irl
min 1
max 1
}
prop rel description="The relation between the current entity and the URL" {
type string
enum self documentation
}
prop ref=#"[id="info-lang"]"#
}
node license description="The license(s) that the schema is licensed under" {
value description="Name of the used license" {
type string
min 1
max 1
}
prop spdx description="An SPDX license identifier" {
type string
}
children {
node ref=#"[id="info-link"]"#
}
}
node published description="When the schema was published" {
value description="Publication date" {
type string
format date
min 1
max 1
}
prop time id=info-time description="A time to accompany the date" {
type string
format time
}
}
node modified description="When the schema was last modified" {
value description="Modification date" {
type string
format date
min 1
max 1
}
prop ref=#"[id="info-time"]"#
}
node version description="The version number of this version of the schema" {
value description="Semver version number" {
type string
pattern #"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"#
min 1
max 1
}
}
}
}
node tag id=tag-node description="A tag belonging to a child node of `document` or another node." {
value description="The name of the tag. If a tag name is not supplied, the node rules apply to _all_ nodes belonging to the parent." {
type string
max 1
}
prop description description="A description of this node's purpose." {
type string
}
prop id description="A globally-unique ID for this node." {
type string
}
prop ref description="A globally unique reference to another node." {
type string
format kdl-query
}
children {
node ref=#"[id="node-names-node"]"#
node ref=#"[id="other-nodes-allowed-node"]"#
node ref=#"[id="node-node"]"#
}
}
node node id=node-node description="A child node belonging either to `document` or to another `node`. Nodes may be anonymous." {
value description="The name of the node. If a node name is not supplied, the node rules apply to _all_ nodes belonging to the parent." {
type string
max 1
}
prop description description="A description of this node's purpose." {
type string
}
prop id description="A globally-unique ID for this node." {
type string
}
prop ref description="A globally unique reference to another node." {
type string
format kdl-query
}
children {
node prop-names description="Validations to apply specifically to arbitrary property names" {
children ref=#"[id="validations"]"#
}
node other-props-allowed description="Whether to allow properties other than the ones explicitly listed. Defaults to '#false'." {
max 1
value {
min 1
max 1
type boolean
}
}
node min description="minimum number of instances of this node in its parent's children." {
max 1
value {
min 1
max 1
type number
}
}
node max description="maximum number of instances of this node in its parent's children." {
max 1
value {
min 1
max 1
type number
}
}
node ref=#"[id="value-tag-node"]"#
node prop id="prop-node" description="A node property key/value pair." {
value description="The property key." {
type string
}
prop id description="A globally-unique ID of this property." {
type string
}
prop ref description="A globally unique reference to another property node." {
type string
format kdl-query
}
prop description description="A description of this property's purpose." {
type string
}
children description="Property-specific validations." {
node required description="Whether this property is required if its parent is present." {
max 1
value {
min 1
max 1
type boolean
}
}
}
children id=validations description="General value validations." {
node tag id=value-tag-node description="The tags associated with this value" {
max 1
children ref=#"[id="validations"]"#
}
node type description="The type for this prop's value." {
max 1
value {
min 1
type string
}
}
node enum description="An enumeration of possible values" {
max 1
value description="Enumeration choices" {
min 1
}
}
node pattern description="PCRE (Regex) pattern or patterns to test prop values against." {
value {
min 1
type string
}
}
node min-length description="Minimum length of prop value, if it's a string." {
max 1
value {
min 1
type number
}
}
node max-length description="Maximum length of prop value, if it's a string." {
max 1
value {
min 1
type number
}
}
node format description="Intended data format." {
max 1
value {
min 1
type string
// https://json-schema.org/understanding-json-schema/reference/string.html#format
enum date-time date time duration decimal currency country-2 country-3 country-subdivision email idn-email hostname idn-hostname ipv4 ipv6 url url-reference irl irl-reference url-template regex uuid kdl-query i8 i16 i32 i64 u8 u16 u32 u64 isize usize f32 f64 decimal64 decimal128
}
}
node % description="Only used for numeric values. Constrains them to be multiples of the given number(s)" {
max 1
value {
min 1
type number
}
}
node > description="Only used for numeric values. Constrains them to be greater than the given number(s)" {
max 1
value {
min 1
max 1
type number
}
}
node ">=" description="Only used for numeric values. Constrains them to be greater than or equal to the given number(s)" {
max 1
value {
min 1
max 1
type number
}
}
node < description="Only used for numeric values. Constrains them to be less than the given number(s)" {
max 1
value {
min 1
max 1
type number
}
}
node "<=" description="Only used for numeric values. Constrains them to be less than or equal to the given number(s)" {
max 1
value {
min 1
max 1
type number
}
}
}
}
node value id=value-node description="one or more direct node values" {
prop id description="A globally-unique ID of this value." {
type string
}
prop ref description="A globally unique reference to another value node." {
type string
format kdl-query
}
prop description description="A description of this property's purpose." {
type string
}
children ref=#"[id="validations"]"#
children description="Node value-specific validations" {
node min description="minimum number of values for this node." {
max 1
value {
min 1
max 1
type number
}
}
node max description="maximum number of values for this node." {
max 1
value {
min 1
max 1
type number
}
}
}
}
node children id=children-node {
prop id description="A globally-unique ID of this children node." {
type string
}
prop ref description="A globally unique reference to another children node." {
type string
format kdl-query
}
prop description description="A description of this these children's purpose." {
type string
}
children ref=#"[id="node-children"]"#
}
}
}
node definitions description="Definitions to reference in parts of the top-level nodes" {
children {
node ref=#"[id="node-node"]"#
node ref=#"[id="value-node"]"#
node ref=#"[id="prop-node"]"#
node ref=#"[id="children-node"]"#
node ref=#"[id="tag-node"]"#
}
}
}
}
}