forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema-event.js
84 lines (82 loc) · 1.58 KB
/
schema-event.js
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
const helpfulness = {
additionalProperties: false,
required: [
'type',
'url',
'vote'
],
properties: {
type: {
type: 'string',
description: 'The type of event.',
pattern: '^HELPFULNESS$'
},
token: {
type: 'string',
description: 'A honeypot.',
maxLength: 0
},
url: {
type: 'string',
description: 'The page the user triggered the event on.',
format: 'uri'
},
vote: {
type: 'string',
description: 'Did the user find the page helpful?',
enum: ['Yes', 'No']
},
email: {
type: 'string',
description: 'The user\'s email address.',
format: 'email'
},
comment: {
type: 'string',
description: 'Any additional comments the user wanted to provide.',
maxLength: 65535
},
category: {
type: 'string',
description: 'The category of the comment',
enum: ['Unclear', 'Confusing', 'Unhelpful', 'Other']
}
}
}
const experiment = {
additionalProperties: false,
required: [
'type',
'user',
'test',
'group'
],
properties: {
type: {
type: 'string',
description: 'The type of event.',
pattern: '^EXPERIMENT$'
},
user: {
type: 'string',
minLength: 16,
format: 'uuid'
},
test: {
type: 'string',
minLength: 4
},
group: {
type: 'string',
enum: ['control', 'treatment']
},
success: {
type: 'string',
enum: ['yes', 'no'],
default: 'yes'
}
}
}
module.exports = {
oneOf: [helpfulness, experiment]
}