-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Expand file tree
/
Copy pathopenapi.yaml
More file actions
294 lines (293 loc) · 7.05 KB
/
openapi.yaml
File metadata and controls
294 lines (293 loc) · 7.05 KB
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
openapi: 3.1.0
info:
description: |
This tests for a oneOf interface representation
title: ByRefOrValue
version: 0.0.1
servers:
- url: http://localhost:8080
tags:
- name: Foo
- name: Bar
paths:
/foo:
get:
operationId: getAllFoos
responses:
"200":
$ref: "#/components/responses/200FooArray"
summary: GET all Foos
tags:
- Foo
x-accepts:
- application/json;charset=utf-8
post:
operationId: createFoo
requestBody:
$ref: "#/components/requestBodies/Foo"
responses:
"201":
$ref: "#/components/responses/201Foo"
summary: Create a Foo
tags:
- Foo
x-content-type: application/json;charset=utf-8
x-accepts:
- application/json
/bar:
post:
operationId: createBar
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Bar_Create"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/Bar"
description: Bar created
summary: Create a Bar
tags:
- Bar
x-content-type: application/json
x-accepts:
- application/json
components:
requestBodies:
Foo:
content:
application/json;charset=utf-8:
schema:
$ref: "#/components/schemas/Foo"
description: The Foo to be created
responses:
"204":
content: {}
description: Deleted
"201Foo":
content:
application/json:
schema:
$ref: "#/components/schemas/FooRefOrValue"
description: Error
"200FooArray":
content:
application/json;charset=utf-8:
schema:
items:
$ref: "#/components/schemas/FooRefOrValue"
type: array
default: null
description: Success
schemas:
Addressable:
description: Base schema for addressable entities
properties:
href:
description: Hyperlink reference
type: string
id:
description: unique identifier
type: string
Extensible:
properties:
'@schemaLocation':
description: A URI to a JSON-Schema file that defines additional attributes
and relationships
type: string
'@baseType':
description: "When sub-classing, this defines the super-class"
type: string
'@type':
description: "When sub-classing, this defines the sub-class Extensible name"
type: string
required:
- '@type'
Entity:
allOf:
- $ref: "#/components/schemas/Addressable"
- $ref: "#/components/schemas/Extensible"
discriminator:
propertyName: '@type'
EntityRef:
allOf:
- $ref: "#/components/schemas/Addressable"
- $ref: "#/components/schemas/Extensible"
- description: Entity reference schema to be use for all entityRef class.
properties:
name:
description: Name of the related entity.
type: string
'@referredType':
description: The actual type of the target instance when needed for disambiguation.
type: string
type: object
example: null
discriminator:
propertyName: '@type'
example: null
FooRefOrValue:
discriminator:
propertyName: '@type'
oneOf:
- $ref: "#/components/schemas/Foo"
- $ref: "#/components/schemas/FooRef"
x-one-of-name: FooRefOrValue
Foo:
allOf:
- $ref: "#/components/schemas/Entity"
- properties:
fooPropA:
type: string
fooPropB:
type: string
type: object
example: null
example:
href: href
id: id
'@schemaLocation': '@schemaLocation'
'@baseType': '@baseType'
'@type': '@type'
fooPropA: fooPropA
fooPropB: fooPropB
FooRef:
allOf:
- $ref: "#/components/schemas/EntityRef"
- properties:
foorefPropA:
type: string
type: object
example: null
example: null
BarRef:
allOf:
- $ref: "#/components/schemas/EntityRef"
Bar_Create:
allOf:
- $ref: "#/components/schemas/Entity"
- properties:
barPropA:
type: string
fooPropB:
type: string
foo:
$ref: "#/components/schemas/FooRefOrValue"
type: object
example: null
example: null
Bar:
allOf:
- $ref: "#/components/schemas/Entity"
- properties:
id:
type: string
barPropA:
type: string
fooPropB:
type: string
foo:
$ref: "#/components/schemas/FooRefOrValue"
required:
- id
type: object
example: null
example:
href: href
id: id
'@schemaLocation': '@schemaLocation'
'@baseType': '@baseType'
'@type': '@type'
barPropA: barPropA
fooPropB: fooPropB
foo:
href: href
id: id
'@schemaLocation': '@schemaLocation'
'@baseType': '@baseType'
'@type': '@type'
fooPropA: fooPropA
fooPropB: fooPropB
BarRefOrValue:
oneOf:
- $ref: "#/components/schemas/Bar"
- $ref: "#/components/schemas/BarRef"
x-one-of-name: BarRefOrValue
Pizza:
allOf:
- $ref: "#/components/schemas/Entity"
- properties:
pizzaSize:
type: number
type: object
example: null
example: null
Pasta:
allOf:
- $ref: "#/components/schemas/Entity"
- properties:
vendor:
type: string
type: object
example: null
example: null
PizzaSpeziale:
allOf:
- $ref: "#/components/schemas/Pizza"
- properties:
toppings:
type: string
type: object
example: null
example: null
FruitType:
enum:
- APPLE
- BANANA
type: string
Fruit:
discriminator:
mapping:
APPLE: "#/components/schemas/Apple"
BANANA: "#/components/schemas/Banana"
propertyName: fruitType
oneOf:
- $ref: "#/components/schemas/Apple"
- $ref: "#/components/schemas/Banana"
properties:
fruitType:
allOf:
- $ref: "#/components/schemas/FruitType"
description: test
required:
- fruitType
x-one-of-name: Fruit
Apple:
properties:
seeds:
type: integer
required:
- seeds
Banana:
properties:
length:
type: integer
required:
- length
Animal:
oneOf:
- $ref: "#/components/schemas/Dog"
- $ref: "#/components/schemas/Cat"
x-one-of-name: Animal
Cat:
properties:
declawed:
type: boolean
Dog:
properties:
bark:
type: boolean