|
1 | | -import meta from './meta' |
| 1 | +import meta from "./meta"; |
2 | 2 |
|
3 | 3 | export default { |
4 | | - title: 'Skeleton Schema', |
| 4 | + title: "Skeleton Schema", |
5 | 5 | description: |
6 | | - 'A CodeRoad tutorial config schema. This data is paired up with the markdown to create a tutorial', |
| 6 | + "A CodeRoad tutorial config schema. This data is paired up with the markdown to create a tutorial", |
7 | 7 | ...meta, |
8 | | - type: 'object', |
| 8 | + type: "object", |
9 | 9 | properties: { |
10 | 10 | version: { |
11 | | - $ref: '#/definitions/semantic_version', |
12 | | - description: 'The tutorial version. Must be unique for the tutorial.', |
13 | | - examples: ['0.1.0', '1.0.0'] |
| 11 | + $ref: "#/definitions/semantic_version", |
| 12 | + description: "The tutorial version. Must be unique for the tutorial.", |
| 13 | + examples: ["0.1.0", "1.0.0"], |
14 | 14 | }, |
15 | 15 |
|
16 | 16 | // config |
17 | 17 | config: { |
18 | | - type: 'object', |
| 18 | + type: "object", |
19 | 19 | properties: { |
20 | 20 | testRunner: { |
21 | | - type: 'object', |
22 | | - description: 'The test runner configuration', |
| 21 | + type: "object", |
| 22 | + description: "The test runner configuration", |
23 | 23 | properties: { |
24 | 24 | command: { |
25 | | - type: 'string', |
26 | | - description: 'Command line to start the test runner', |
27 | | - examples: ['./node_modules/.bin/mocha'] |
| 25 | + type: "string", |
| 26 | + description: "Command line to start the test runner", |
| 27 | + examples: ["./node_modules/.bin/mocha"], |
28 | 28 | }, |
29 | 29 | args: { |
30 | | - type: 'object', |
| 30 | + type: "object", |
31 | 31 | description: |
32 | | - 'A configuration of command line args for your test runner', |
| 32 | + "A configuration of command line args for your test runner", |
33 | 33 | properties: { |
34 | 34 | filter: { |
35 | | - type: 'string', |
| 35 | + type: "string", |
36 | 36 | description: |
37 | | - 'the command line arg for filtering tests with a regex pattern', |
38 | | - examples: ['--grep'] |
| 37 | + "the command line arg for filtering tests with a regex pattern", |
| 38 | + examples: ["--grep"], |
39 | 39 | }, |
40 | 40 | tap: { |
41 | | - type: 'string', |
| 41 | + type: "string", |
42 | 42 | description: |
43 | | - 'The command line arg for configuring a TAP reporter. See https://github.com/sindresorhus/awesome-tap for examples.', |
44 | | - examples: ['--reporter=mocha-tap-reporter'] |
45 | | - } |
| 43 | + "The command line arg for configuring a TAP reporter. See https://github.com/sindresorhus/awesome-tap for examples.", |
| 44 | + examples: ["--reporter=mocha-tap-reporter"], |
| 45 | + }, |
46 | 46 | }, |
47 | 47 | additionalProperties: false, |
48 | | - required: ['tap'] |
| 48 | + required: ["tap"], |
49 | 49 | }, |
50 | 50 | directory: { |
51 | | - type: 'string', |
52 | | - description: 'An optional folder for the test runner', |
53 | | - examples: ['coderoad'] |
54 | | - } |
| 51 | + type: "string", |
| 52 | + description: "An optional folder for the test runner", |
| 53 | + examples: ["coderoad"], |
| 54 | + }, |
55 | 55 | }, |
56 | | - required: ['command', 'args'] |
| 56 | + required: ["command", "args"], |
57 | 57 | }, |
58 | 58 | setup: { |
59 | | - type: 'object', |
| 59 | + type: "object", |
60 | 60 | description: |
61 | | - 'Setup commits or commands used for setting up the test runner on tutorial launch', |
| 61 | + "Setup commits or commands used for setting up the test runner on tutorial launch", |
62 | 62 | properties: { |
63 | 63 | commits: { |
64 | | - $ref: '#/definitions/commit_array' |
| 64 | + $ref: "#/definitions/commit_array", |
65 | 65 | }, |
66 | 66 | commands: { |
67 | | - $ref: '#/definitions/command_array' |
| 67 | + $ref: "#/definitions/command_array", |
68 | 68 | }, |
69 | 69 | vscodeCommands: { |
70 | | - $ref: '#/definitions/vscode_command_array' |
71 | | - } |
72 | | - } |
| 70 | + $ref: "#/definitions/vscode_command_array", |
| 71 | + }, |
| 72 | + }, |
73 | 73 | }, |
74 | 74 | repo: { |
75 | | - type: 'object', |
76 | | - description: 'The repo holding the git commits for the tutorial', |
| 75 | + type: "object", |
| 76 | + description: "The repo holding the git commits for the tutorial", |
77 | 77 | properties: { |
78 | 78 | uri: { |
79 | | - type: 'string', |
80 | | - description: 'The uri source of the tutorial', |
81 | | - format: 'uri', |
82 | | - examples: ['https://github.com/name/tutorial-name.git'] |
| 79 | + type: "string", |
| 80 | + description: "The uri source of the tutorial", |
| 81 | + format: "uri", |
| 82 | + examples: ["https://github.com/name/tutorial-name.git"], |
83 | 83 | }, |
84 | 84 | branch: { |
85 | 85 | description: |
86 | | - 'The branch of the repo where the tutorial config file exists', |
87 | | - type: 'string', |
88 | | - examples: ['master'] |
89 | | - } |
| 86 | + "The branch of the repo where the tutorial config file exists", |
| 87 | + type: "string", |
| 88 | + examples: ["master"], |
| 89 | + }, |
90 | 90 | }, |
91 | 91 | additionalProperties: false, |
92 | | - required: ['uri', 'branch'] |
| 92 | + required: ["uri", "branch"], |
93 | 93 | }, |
94 | 94 | reset: { |
95 | | - type: 'object', |
96 | | - description: 'Configuration options for resetting a tutorial', |
| 95 | + type: "object", |
| 96 | + description: "Configuration options for resetting a tutorial", |
97 | 97 | properties: { |
98 | 98 | commands: { |
99 | | - $ref: '#/definitions/command_array' |
| 99 | + $ref: "#/definitions/command_array", |
100 | 100 | }, |
101 | 101 | vscodeCommands: { |
102 | | - $ref: '#/definitions/vscode_command_array' |
103 | | - } |
| 102 | + $ref: "#/definitions/vscode_command_array", |
| 103 | + }, |
104 | 104 | }, |
105 | | - additionalProperties: false |
| 105 | + additionalProperties: false, |
106 | 106 | }, |
107 | 107 | dependencies: { |
108 | | - type: 'array', |
109 | | - description: 'A list of tutorial dependencies', |
| 108 | + type: "array", |
| 109 | + description: "A list of tutorial dependencies", |
110 | 110 | items: { |
111 | | - type: 'object', |
| 111 | + type: "object", |
112 | 112 | properties: { |
113 | 113 | name: { |
114 | | - type: 'string', |
| 114 | + type: "string", |
115 | 115 | description: |
116 | | - 'The command line process name of the dependency. It will be checked by running `name --version`', |
117 | | - examples: ['node', 'python'] |
| 116 | + "The command line process name of the dependency. It will be checked by running `name --version`", |
| 117 | + examples: ["node", "python"], |
118 | 118 | }, |
119 | 119 | version: { |
120 | | - type: 'string', |
| 120 | + type: "string", |
121 | 121 | description: |
122 | | - 'The version requirement. See https://github.com/npm/node-semver for options', |
123 | | - examples: ['>=10'] |
124 | | - } |
| 122 | + "The version requirement. See https://github.com/npm/node-semver for options", |
| 123 | + examples: [">=10"], |
| 124 | + }, |
125 | 125 | }, |
126 | | - required: ['name', 'version'] |
127 | | - } |
| 126 | + required: ["name", "version"], |
| 127 | + }, |
128 | 128 | }, |
129 | 129 | appVersions: { |
130 | | - type: 'object', |
| 130 | + type: "object", |
131 | 131 | description: |
132 | | - 'A list of compatable coderoad versions. Currently only a VSCode extension.', |
| 132 | + "A list of compatable coderoad versions. Currently only a VSCode extension.", |
133 | 133 | properties: { |
134 | 134 | vscode: { |
135 | | - type: 'string', |
| 135 | + type: "string", |
136 | 136 | description: |
137 | | - 'The version range for coderoad-vscode that this tutorial is compatable with', |
138 | | - examples: ['>=0.7.0'] |
139 | | - } |
140 | | - } |
141 | | - } |
142 | | - }, |
143 | | - webhook: { |
144 | | - type: 'object', |
145 | | - description: 'An optional configuration for webhooks triggered by events such as init, step/level/tutorial complete', |
146 | | - properties: { |
147 | | - url: { |
148 | | - type: 'string', |
149 | | - description: 'URL for POST restful webhook request', |
150 | | - examples: ['https://example.com/webhook'] |
| 137 | + "The version range for coderoad-vscode that this tutorial is compatable with", |
| 138 | + examples: [">=0.7.0"], |
| 139 | + }, |
151 | 140 | }, |
152 | | - events: { |
153 | | - type: 'object', |
154 | | - description: 'An object of events to trigger on', |
155 | | - properties: { |
156 | | - init: { |
157 | | - type: 'boolean', |
158 | | - description: |
159 | | - 'An event triggered on tutorial startup. Sends tutorialId', |
160 | | - }, |
161 | | - reset: { |
162 | | - type: 'boolean', |
163 | | - description: |
164 | | - 'An event triggered on reset of a tutorial. Sends tutorialId', |
165 | | - }, |
166 | | - step_complete: { |
167 | | - type: 'boolean', |
168 | | - description: |
169 | | - 'An event triggered on completion of a step. Sends tutorialId, levelId & stepId', |
170 | | - }, |
171 | | - level_complete: { |
172 | | - step_complete: { |
173 | | - type: 'boolean', |
| 141 | + }, |
| 142 | + webhook: { |
| 143 | + type: "object", |
| 144 | + description: |
| 145 | + "An optional configuration for webhooks triggered by events such as init, step/level/tutorial complete", |
| 146 | + properties: { |
| 147 | + url: { |
| 148 | + type: "string", |
| 149 | + description: "URL for POST restful webhook request", |
| 150 | + examples: ["https://example.com/webhook"], |
| 151 | + }, |
| 152 | + events: { |
| 153 | + type: "object", |
| 154 | + description: "An object of events to trigger on", |
| 155 | + properties: { |
| 156 | + init: { |
| 157 | + type: "boolean", |
174 | 158 | description: |
175 | | - 'An event triggered on completion of a level. Sends tutorialId & levelId', |
| 159 | + "An event triggered on tutorial startup. Sends tutorialId", |
| 160 | + }, |
| 161 | + reset: { |
| 162 | + type: "boolean", |
| 163 | + description: |
| 164 | + "An event triggered on reset of a tutorial. Sends tutorialId", |
176 | 165 | }, |
177 | | - }, |
178 | | - tutorial_complete: { |
179 | 166 | step_complete: { |
180 | | - type: 'boolean', |
| 167 | + type: "boolean", |
181 | 168 | description: |
182 | | - 'An event triggered on completion of a tutorial. Sends tutorialId', |
| 169 | + "An event triggered on completion of a step. Sends tutorialId, levelId & stepId", |
| 170 | + }, |
| 171 | + level_complete: { |
| 172 | + step_complete: { |
| 173 | + type: "boolean", |
| 174 | + description: |
| 175 | + "An event triggered on completion of a level. Sends tutorialId & levelId", |
| 176 | + }, |
| 177 | + }, |
| 178 | + tutorial_complete: { |
| 179 | + step_complete: { |
| 180 | + type: "boolean", |
| 181 | + description: |
| 182 | + "An event triggered on completion of a tutorial. Sends tutorialId", |
| 183 | + }, |
183 | 184 | }, |
184 | | - } |
185 | | - } |
| 185 | + }, |
| 186 | + }, |
| 187 | + additionalProperties: false, |
186 | 188 | }, |
187 | | - } |
| 189 | + }, |
188 | 190 | }, |
189 | 191 | additionalProperties: false, |
190 | | - required: ['testRunner', 'repo'] |
| 192 | + required: ["testRunner", "repo"], |
191 | 193 | }, |
192 | 194 |
|
193 | 195 | // levels |
194 | 196 | levels: { |
195 | | - type: 'array', |
| 197 | + type: "array", |
196 | 198 | description: |
197 | 199 | 'Levels are the stages a user goes through in the tutorial. A level may contain a group of tasks called "steps" that must be completed to proceed', |
198 | 200 | items: { |
199 | | - type: 'object', |
| 201 | + type: "object", |
200 | 202 | properties: { |
201 | 203 | id: { |
202 | | - type: 'string', |
203 | | - description: 'A level id', |
204 | | - examples: ['1', '11'] |
| 204 | + type: "string", |
| 205 | + description: "A level id", |
| 206 | + examples: ["1", "11"], |
205 | 207 | }, |
206 | 208 | setup: { |
207 | | - $ref: '#/definitions/setup_action_without_commits', |
| 209 | + $ref: "#/definitions/setup_action_without_commits", |
208 | 210 | description: |
209 | | - 'An optional point for running actions, commands or opening files' |
| 211 | + "An optional point for running actions, commands or opening files", |
210 | 212 | }, |
211 | 213 | steps: { |
212 | | - type: 'array', |
| 214 | + type: "array", |
213 | 215 | items: { |
214 | | - type: 'object', |
| 216 | + type: "object", |
215 | 217 | properties: { |
216 | 218 | id: { |
217 | | - type: 'string', |
218 | | - description: 'A level id', |
219 | | - examples: ['1.1', '11.12'] |
| 219 | + type: "string", |
| 220 | + description: "A level id", |
| 221 | + examples: ["1.1", "11.12"], |
220 | 222 | }, |
221 | 223 | setup: { |
222 | 224 | allOf: [ |
223 | 225 | { |
224 | | - $ref: '#/definitions/setup_action_without_commits', |
| 226 | + $ref: "#/definitions/setup_action_without_commits", |
225 | 227 | description: |
226 | | - 'A point for running actions, commands and/or opening files' |
227 | | - } |
228 | | - ] |
| 228 | + "A point for running actions, commands and/or opening files", |
| 229 | + }, |
| 230 | + ], |
229 | 231 | }, |
230 | 232 | solution: { |
231 | 233 | allOf: [ |
232 | 234 | { |
233 | | - $ref: '#/definitions/setup_action_without_commits', |
| 235 | + $ref: "#/definitions/setup_action_without_commits", |
234 | 236 | description: |
235 | | - 'The solution can be loaded if the user gets stuck. It can run actions, commands and/or open files' |
| 237 | + "The solution can be loaded if the user gets stuck. It can run actions, commands and/or open files", |
236 | 238 | }, |
237 | 239 | { |
238 | | - required: [] |
239 | | - } |
240 | | - ] |
241 | | - } |
| 240 | + required: [], |
| 241 | + }, |
| 242 | + ], |
| 243 | + }, |
242 | 244 | }, |
243 | | - required: ['id'] |
244 | | - } |
245 | | - } |
| 245 | + required: ["id"], |
| 246 | + }, |
| 247 | + }, |
246 | 248 | }, |
247 | | - required: ['id'] |
| 249 | + required: ["id"], |
248 | 250 | }, |
249 | | - minItems: 1 |
250 | | - } |
| 251 | + minItems: 1, |
| 252 | + }, |
251 | 253 | }, |
252 | 254 | additionalProperties: false, |
253 | | - required: ['version', 'config', 'levels'] |
254 | | -} |
| 255 | + required: ["version", "config", "levels"], |
| 256 | +}; |
0 commit comments