-
Notifications
You must be signed in to change notification settings - Fork 25k
/
Copy pathschema.json
245 lines (245 loc) · 8.13 KB
/
schema.json
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
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/elastic/elasticsearch/tree/master/rest-api-spec",
"$ref": "#/definitions/Api",
"definitions": {
"Api": {
"type": "object",
"propertyNames": {
"pattern": "^[a-z]+?(_[a-z]+)*(\\.[a-z]+?(_[a-z]+)*)?$"
},
"minProperties": 1,
"maxProperties": 1,
"patternProperties": {
"^[a-z]+?(_[a-z]+)*(\\.[a-z]+?(_[a-z]+)*)?$": {
"$ref": "#/definitions/Components"
}
},
"additionalProperties": false,
"title": "API name",
"description": "An object with a single property name of the API and value of the API components"
},
"Components": {
"type": "object",
"additionalProperties": false,
"properties": {
"deprecated": {
"$ref": "#/definitions/Deprecated"
},
"documentation": {
"$ref": "#/definitions/Documentation"
},
"stability": {
"type": "string",
"enum": ["stable", "beta", "experimental", "private"]
},
"url": {
"$ref": "#/definitions/Url"
},
"params": {
"$ref": "#/definitions/Params"
},
"body": {
"$ref": "#/definitions/Body"
}
},
"required": [
"documentation",
"stability",
"url"
],
"title": "API components",
"description": "The components that make up the API"
},
"Url": {
"type": "object",
"additionalProperties": false,
"properties": {
"paths": {
"type": "array",
"items": {
"$ref": "#/definitions/Path"
},
"minLength": 1
}
},
"required": [
"paths"
],
"title": "API urls",
"description": "An array of the URL path variants for the API"
},
"Params": {
"type": "object",
"additionalProperties": true,
"propertyNames": {
"pattern": "^_?[a-z]+?(_[a-z]+)*$"
},
"patternProperties": {
"^_?[a-z]+?(_[a-z]+)*$": {
"$ref": "#/definitions/ParamPart"
}
},
"title": "API query string parameters",
"description": "A collection of the query string parameters for the API"
},
"Body": {
"type": "object",
"additionalProperties": false,
"properties": {
"description": {
"type": "string"
},
"required": {
"type": "boolean"
},
"serialize": {
"type": "string",
"enum": ["bulk"]
}
},
"required": [
"description"
],
"title": "API request Body",
"description": "The request body for the API. Does not detail the structure, only whether the API accepts a body and its format"
},
"Deprecated": {
"type": "object",
"additionalProperties": false,
"properties": {
"version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+$",
"title": "The version from which deprecation applies"
},
"description": {
"type": "string",
"title": "A description for the deprecation, which may include alternatives to use"
}
},
"required": [
"description",
"version"
],
"title": "Deprecation",
"description": "Indicates if part of the API is deprecated, in what version and why"
},
"Documentation": {
"type": "object",
"additionalProperties": false,
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"description": {
"type": "string"
}
},
"required": [
"url",
"description"
],
"title": "Documentation",
"description": "API documentation including a link to the public reference and a short descritpion"
},
"Parts": {
"type": "object",
"additionalProperties": true,
"propertyNames": {
"pattern": "^_?[a-z]+?(_[a-z]+)*$"
},
"patternProperties": {
"^_?[a-z]+?(_[a-z]+)*$": {
"$ref": "#/definitions/ParamPart"
}
},
"title": "API url parts",
"description": "Variable parts that make up an API url path"
},
"ParamPart": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"pattern": "^list|date|time|string|enum|int|double|long|boolean|number$",
"title": "The type of the parameter."
},
"options": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z_]+$"
},
"title": "Valid options when type is an enum"
},
"default": {
"type": ["string", "number", "boolean"],
"title": "Default value"
},
"deprecated": {
"oneOf": [
{ "$ref": "#/definitions/Deprecated" },
{ "type": "boolean" }
]
},
"description": {
"type": "string",
"title": "A description for the parameter"
},
"required": {
"type": "boolean",
"title": "Whether the parameter is required"
}
},
"required": [
"description",
"type"
],
"allOf": [
{
"if": {
"properties": { "type": { "const": "enum" } }
},
"then": {
"required": ["options"]
}
}
],
"title": "API parameter or part",
"description": "The properties of an API parameter or part"
},
"Path": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"pattern": "^\\/([a-z0-9\\/_{}])*$"
},
"methods": {
"type": "array",
"items": {
"type": "string",
"enum": ["DELETE", "GET", "HEAD", "POST", "PUT"],
"minLength": 1
}
},
"parts": {
"$ref": "#/definitions/Parts"
},
"deprecated": {
"$ref": "#/definitions/Deprecated"
}
},
"required": [
"methods",
"path"
],
"title": "API path",
"description": "A path variant for the API including the HTTP methods it supports and parts"
}
}
}