-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.go
274 lines (273 loc) · 8.32 KB
/
schema.go
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
// Schema needed to validate our config in some kinda sane way without
// the need of a parser. https://jsonschema.net does a nice job of giving
// you something you can work with quickly. You can also read more about it
// on https://json-schema.org/understanding-json-schema/index.html where they
// do a pretty good job at showing you how everything works.
//
// A lot of the enums will need to have "" also added to them unless they are
// required in the config. This is because we are taking YAML packing it into
// a go struct and converting it to JSON.
package main
var schema = `
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"interval",
"path"
],
"properties": {
"interval": {
"$id": "#/properties/interval",
"type": "integer",
"title": "The Interval Schema"
},
"path": {
"$id": "#/properties/path",
"type": "string",
"title": "The Path Schema"
},
"repos": {
"$id": "#/properties/repos",
"type": "array",
"title": "The Repos Schema",
"items": {
"$id": "#/properties/repos/items",
"type": "object",
"title": "The Items Schema",
"required": [
"url",
"type"
],
"properties": {
"url": {
"$id": "#/properties/repos/items/properties/url",
"type": "string",
"title": "The Url Schema"
},
"extras": {
"$id": "#/properties/repos/items/properties/extras",
"type": "object",
"title": "The Extras Schema",
"properties": {
"username": {
"$id": "#/properties/github/items/properties/extras/properties/username",
"type": "string",
"title": "The User Schema"
},
"cgitsection": {
"$id": "#/properties/github/items/properties/extras/properties/cgitsection",
"type": "string",
"title": "The Cgitsection Schema"
},
"cgitowner": {
"$id": "#/properties/github/items/properties/extras/properties/cgitowner",
"type": "string",
"title": "The Cgitowner Schema"
},
"cgitdescription": {
"$id": "#/properties/github/items/properties/extras/properties/description",
"type": "string",
"title": "The Cgitdescription Schema"
}
}
},
"httpauth": {
"$id": "#/properties/repos/items/properties/httpauth",
"type": "object",
"title": "The Httpauth Schema",
"required": [
"user",
"token"
],
"properties": {
"user": {
"$id": "#/properties/github/items/properties/httpauth/properties/user",
"type": "string",
"title": "The User Schema"
},
"token": {
"$id": "#/properties/github/items/properties/httpauth/properties/token",
"type": "string",
"title": "The Token Schema"
}
}
},
"sshauth": {
"$id": "#/properties/repos/items/properties/sshauth",
"type": "object",
"title": "The Sshauth Schema",
"required": [
"user",
"password"
],
"properties": {
"user": {
"$id": "#/properties/github/items/properties/sshauth/properties/user",
"type": "string",
"title": "The User Schema"
},
"token": {
"$id": "#/properties/github/items/properties/sshauth/properties/password",
"type": "string",
"title": "The Password Schema"
}
}
},
"sshkeyauth": {
"$id": "#/properties/repos/items/properties/sshkeyauth",
"type": "object",
"title": "The Sshkeyauth Schema",
"required": [
"user",
"keypath"
],
"properties": {
"user": {
"$id": "#/properties/github/items/properties/sshkeyauth/properties/user",
"type": "string",
"title": "The User Schema"
},
"keypath": {
"$id": "#/properties/github/items/properties/sshkeyauth/properties/keypath",
"type": "string",
"title": "The Keypath Schema"
}
}
},
"type": {
"$id": "#/properties/repos/items/properties/type",
"type": "string",
"title": "The Type Schema",
"enum": [
"fetch_mirror",
"push_mirror"
]
},
"path": {
"$id": "#/properties/repos/items/properties/path",
"type": "string",
"title": "The Path Schema"
},
"refs": {
"$id": "#/properties/repos/items/properties/refs",
"type": [
"array",
"null"
],
"title": "The Refs Schema",
"items": {
"$id": "#/properties/repos/items/properties/refs/items",
"type": "string",
"title": "The Items Schema"
}
},
"metadata": {
"$id": "#/properties/repos/items/properties/metadata",
"type": [
"array",
"null"
],
"title": "The Metadata Schema",
"items": {
"$id": "#/properties/repos/items/properties/metadata/items",
"type": "string",
"title": "The Items Schema",
"default": "",
"examples": [
"cgit"
],
"enum": [
"cgit"
]
}
}
}
}
},
"github": {
"$id": "#/properties/github",
"type": [
"array",
"null"
],
"title": "The Github Schema",
"items": {
"$id": "#/properties/github/items",
"type": "object",
"title": "The Items Schema",
"required": [
"username"
],
"properties": {
"username": {
"$id": "#/properties/github/items/properties/username",
"type": "string",
"title": "The Username Schema"
},
"extras": {
"$ref": "#/properties/repos/items/properties/extras"
},
"httpauth": {
"$ref": "#/properties/repos/items/properties/httpauth"
},
"sshauth": {
"$ref": "#/properties/repos/items/properties/sshauth"
},
"sshkeyauth": {
"$ref": "#/properties/repos/items/properties/sshkeyauth"
},
"repos": {
"$id": "#/properties/github/items/properties/repos",
"type": "boolean",
"title": "The Repos Schema"
},
"protocol": {
"$id": "#/properties/github/items/properties/protocol",
"type": "string",
"title": "The Protocol Schema",
"enum": [
"local",
"ssh",
"http",
"git",
""
]
},
"repotype": {
"$id": "#/properties/github/items/properties/repotype",
"type": "string",
"title": "The Repotype Schema",
"enum": [
"all",
"public",
"private",
"forks",
"sources",
""
]
},
"metadata": {
"$id": "#/properties/github/items/properties/metadata",
"type": [
"array",
"null"
],
"title": "The Metadata Schema",
"items": {
"$id": "#/properties/github/items/properties/metadata/items",
"type": "string",
"title": "The Items Schema",
"enum": [
"cgit"
]
}
}
}
}
}
}
}
`