Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99b3dbe

Browse files
committed
validate webhook schema
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent61f23ef commit99b3dbe

File tree

4 files changed

+328
-304
lines changed

4 files changed

+328
-304
lines changed

‎src/schema/skeleton.ts

Lines changed: 144 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,254 +1,256 @@
1-
importmetafrom'./meta'
1+
importmetafrom"./meta";
22

33
exportdefault{
4-
title:'Skeleton Schema',
4+
title:"Skeleton Schema",
55
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",
77
...meta,
8-
type:'object',
8+
type:"object",
99
properties:{
1010
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"],
1414
},
1515

1616
// config
1717
config:{
18-
type:'object',
18+
type:"object",
1919
properties:{
2020
testRunner:{
21-
type:'object',
22-
description:'The test runner configuration',
21+
type:"object",
22+
description:"The test runner configuration",
2323
properties:{
2424
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"],
2828
},
2929
args:{
30-
type:'object',
30+
type:"object",
3131
description:
32-
'A configuration of command line args for your test runner',
32+
"A configuration of command line args for your test runner",
3333
properties:{
3434
filter:{
35-
type:'string',
35+
type:"string",
3636
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"],
3939
},
4040
tap:{
41-
type:'string',
41+
type:"string",
4242
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+
},
4646
},
4747
additionalProperties:false,
48-
required:['tap']
48+
required:["tap"],
4949
},
5050
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+
},
5555
},
56-
required:['command','args']
56+
required:["command","args"],
5757
},
5858
setup:{
59-
type:'object',
59+
type:"object",
6060
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",
6262
properties:{
6363
commits:{
64-
$ref:'#/definitions/commit_array'
64+
$ref:"#/definitions/commit_array",
6565
},
6666
commands:{
67-
$ref:'#/definitions/command_array'
67+
$ref:"#/definitions/command_array",
6868
},
6969
vscodeCommands:{
70-
$ref:'#/definitions/vscode_command_array'
71-
}
72-
}
70+
$ref:"#/definitions/vscode_command_array",
71+
},
72+
},
7373
},
7474
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",
7777
properties:{
7878
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"],
8383
},
8484
branch:{
8585
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+
},
9090
},
9191
additionalProperties:false,
92-
required:['uri','branch']
92+
required:["uri","branch"],
9393
},
9494
reset:{
95-
type:'object',
96-
description:'Configuration options for resetting a tutorial',
95+
type:"object",
96+
description:"Configuration options for resetting a tutorial",
9797
properties:{
9898
commands:{
99-
$ref:'#/definitions/command_array'
99+
$ref:"#/definitions/command_array",
100100
},
101101
vscodeCommands:{
102-
$ref:'#/definitions/vscode_command_array'
103-
}
102+
$ref:"#/definitions/vscode_command_array",
103+
},
104104
},
105-
additionalProperties:false
105+
additionalProperties:false,
106106
},
107107
dependencies:{
108-
type:'array',
109-
description:'A list of tutorial dependencies',
108+
type:"array",
109+
description:"A list of tutorial dependencies",
110110
items:{
111-
type:'object',
111+
type:"object",
112112
properties:{
113113
name:{
114-
type:'string',
114+
type:"string",
115115
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"],
118118
},
119119
version:{
120-
type:'string',
120+
type:"string",
121121
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+
},
125125
},
126-
required:['name','version']
127-
}
126+
required:["name","version"],
127+
},
128128
},
129129
appVersions:{
130-
type:'object',
130+
type:"object",
131131
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.",
133133
properties:{
134134
vscode:{
135-
type:'string',
135+
type:"string",
136136
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+
},
151140
},
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",
174158
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",
176165
},
177-
},
178-
tutorial_complete:{
179166
step_complete:{
180-
type:'boolean',
167+
type:"boolean",
181168
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+
},
183184
},
184-
}
185-
}
185+
},
186+
},
187+
additionalProperties:false,
186188
},
187-
}
189+
},
188190
},
189191
additionalProperties:false,
190-
required:['testRunner','repo']
192+
required:["testRunner","repo"],
191193
},
192194

193195
// levels
194196
levels:{
195-
type:'array',
197+
type:"array",
196198
description:
197199
'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',
198200
items:{
199-
type:'object',
201+
type:"object",
200202
properties:{
201203
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"],
205207
},
206208
setup:{
207-
$ref:'#/definitions/setup_action_without_commits',
209+
$ref:"#/definitions/setup_action_without_commits",
208210
description:
209-
'An optional point for running actions, commands or opening files'
211+
"An optional point for running actions, commands or opening files",
210212
},
211213
steps:{
212-
type:'array',
214+
type:"array",
213215
items:{
214-
type:'object',
216+
type:"object",
215217
properties:{
216218
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"],
220222
},
221223
setup:{
222224
allOf:[
223225
{
224-
$ref:'#/definitions/setup_action_without_commits',
226+
$ref:"#/definitions/setup_action_without_commits",
225227
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+
],
229231
},
230232
solution:{
231233
allOf:[
232234
{
233-
$ref:'#/definitions/setup_action_without_commits',
235+
$ref:"#/definitions/setup_action_without_commits",
234236
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",
236238
},
237239
{
238-
required:[]
239-
}
240-
]
241-
}
240+
required:[],
241+
},
242+
],
243+
},
242244
},
243-
required:['id']
244-
}
245-
}
245+
required:["id"],
246+
},
247+
},
246248
},
247-
required:['id']
249+
required:["id"],
248250
},
249-
minItems:1
250-
}
251+
minItems:1,
252+
},
251253
},
252254
additionalProperties:false,
253-
required:['version','config','levels']
254-
}
255+
required:["version","config","levels"],
256+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp