forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
operation-schema.js
83 lines (79 loc) · 2.05 KB
/
operation-schema.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
#!/usr/bin/env node
// This schema is used to validate each generated operation object at build time
export default {
type: 'object',
// Every operation must have these props
required: [
'verb',
'requestPath',
'parameters',
'responses',
'slug',
'x-codeSamples',
'category',
'categoryLabel',
],
properties: {
// Properties from the source OpenAPI schema that this module depends on
externalDocs: {
description: 'The public documentation for the given operation',
type: 'object',
required: ['description', 'url'],
properties: {
description: {
type: 'string',
},
url: {
type: 'string',
},
},
},
operationId: {
type: 'string',
minLength: 1,
},
parameters: {
description:
'Parameters to the operation that can be present in the URL path, the query, headers, or a POST body',
type: 'array',
},
// Additional derived properties not found in the source OpenAPI schema
verb: {
description: 'The HTTP method',
type: 'string',
enum: ['get', 'put', 'post', 'delete', 'patch', 'head'],
},
requestPath: {
description: 'The URL path',
type: 'string',
minLength: 1,
},
descriptionHTML: {
description: 'The rendered HTML version of the markdown `description` property',
type: 'string',
},
notes: {
type: 'array',
},
slug: {
description: 'GitHub.com-style param-case property for use as a unique DOM id',
type: 'string',
},
category: {
description: 'the `issues` in `/v3/issues/events/`; supports legacy developer site URLs',
type: 'string',
},
categoryLabel: {
description: 'humanized form of category',
type: 'string',
},
subcategory: {
description: 'the `events` in `/v3/issues/events/`; supports legacy developer site URLs',
type: 'string',
},
subcategoryLabel: {
description: 'humanized form of subcategory',
type: 'string',
},
},
}