Skip to content

Commit 9371762

Browse files
committed
cue schema
1 parent c320f40 commit 9371762

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

data-raw/schema.cue

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// usage: cue vet -c schema.cue file.yml
2+
3+
"guide.version"! : #Version
4+
"template.name"! : string
5+
"template.min.version"! : #Version
6+
"template.max.version"! : #Version | null
7+
"plate.format"! : #Plateformat
8+
"locations"! : [...#Location]
9+
"translations" : [...#Translation]
10+
11+
12+
#Version: =~ "^\\d+\\.\\d+$" // Only version numbers in major.minor format allowed
13+
14+
#Plateformat: 96 | 384
15+
16+
//#AnyLocation: {
17+
// "sheet"! : string
18+
// "varname"! : #VariableName
19+
// "translate"? : bool | *false
20+
// "atomicclass"? : #Atom | [...#Atom] | *"character"
21+
//}
22+
23+
//#CellLocation: {
24+
// "type"! : "cells"
25+
// "variables"! : [...#Variable]
26+
// ...
27+
//}
28+
29+
//#RangeLocation: {
30+
// "type"! : "keyvalue" | "platedata" | "table"
31+
// "ranges"! : [...#Range]
32+
// ...
33+
//}
34+
35+
// This does not work:
36+
// #Location: #AnyLocation & {#CellLocation | #RangeLocation}
37+
38+
#Location: {
39+
"sheet"! : string
40+
"varname"! : #VariableName
41+
"translate"? : bool | *false
42+
"type"! : "cells"
43+
"variables"! : [...#Variable]
44+
"atomicclass"? : #Atom | [...#Atom] | *"character"
45+
} | {
46+
"sheet"! : string
47+
"varname"! : #VariableName
48+
"translate"? : bool | *false
49+
"type"! : "keyvalue" | "platedata" | "table"
50+
"ranges"! : [...#Range]
51+
"atomicclass"? : #Atom | [...#Atom] | *"character"
52+
}
53+
54+
#Variable: {
55+
"name"! : #VariableName
56+
"cell"! : #Cell
57+
}
58+
59+
#Translation: {
60+
"short"! : string
61+
"long"! : string
62+
}
63+
64+
#Atom : "character" | "date" | "numeric"
65+
66+
#Range : =~ "^[A-Z]\\d+:[A-Z]\\d+$" // Valid spreadsheed range value required
67+
68+
#Cell : =~ "^[A-Z]\\d+$" // Valid spreadsheed cell value required
69+
70+
#VariableName : =~ "[^\\s]" // variable names are not allowed to contain space-like characters

0 commit comments

Comments
 (0)