-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
351 lines (344 loc) · 11.3 KB
/
openapi.yaml
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
openapi: 3.0.0
info:
title: Car
version: 2.1.0
description: Domain Microservice API 2.1.0 providing static and dynamic car data
servers: [ ]
paths:
/cars:
get:
summary: Get VINs of all Cars
operationId: getCars
responses:
'200':
description: The VINs of all cars maintained by the system.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/vin'
post:
summary: Add a New Car
operationId: addCar
requestBody:
description: Static car object that should be added.
content:
application/json:
schema:
$ref: '#/components/schemas/staticCar'
required: true
responses:
"201":
description: The operation was successful. The response contains the VIN of the newly added car.
content:
application/json:
schema:
$ref: '#/components/schemas/vin'
"400":
description: The request body is invalid (i.e. violates the schema).
"409":
description: A car with the specified VIN already exists.
/cars/{vin}:
parameters:
- $ref: '#/components/parameters/vinParam'
get:
summary: Get All Information About a Specific Car
operationId: getCar
description: Return all (static and dynamic) information about a car specified by its VIN.
responses:
'200':
description: The operation was successful.
content:
application/json:
schema:
$ref: '#/components/schemas/dynamicCar'
"400":
$ref: '#/components/responses/vinInvalid'
"404":
$ref: '#/components/responses/carNotFound'
delete:
summary: Remove a Car from the System
operationId: deleteCar
responses:
"204":
description: The resource was deleted successfully.
"400":
$ref: '#/components/responses/vinInvalid'
"404":
$ref: '#/components/responses/carNotFound'
/cars/{vin}/trunkLock:
parameters:
- $ref: '#/components/parameters/vinParam'
put:
summary: Open or Close Trunk
operationId: changeTrunkLockState
requestBody:
description: Requested LockState for the trunk.
content:
application/json:
schema:
$ref: '#/components/schemas/lockState'
responses:
'204':
description: The operation was successful.
'400':
$ref: '#/components/responses/vinInvalid'
'404':
$ref: '#/components/responses/carNotFound'
components:
schemas:
staticCar:
type: object
required:
- vin
- brand
- model
- productionDate
- technicalSpecification
properties:
vin:
$ref: '#/components/schemas/vin'
brand:
type: string
example: "Audi"
description: Data that specifies the brand name of the Vehicle manufacturer
model:
type: string
example: "A3"
description: Data that specifies the particular type of a Vehicle
productionDate:
type: string
format: date
example: "2017-07-21"
description: Data that specifies the official date the vehicle was declared to have exited production by the manufacturer.
technicalSpecification:
$ref: '#/components/schemas/technicalSpecification'
dynamicCar:
type: object
required:
- vin
- brand
- model
- productionDate
- technicalSpecification
- dynamicData
properties:
vin:
$ref: '#/components/schemas/vin'
brand:
type: string
example: "Audi"
description: Data that specifies the brand name of the Vehicle manufacturer
model:
type: string
example: "A3"
description: Data that specifies the particular type of a Vehicle
productionDate:
type: string
format: date
example: "2017-07-21"
description: Data that specifies the official date the vehicle was declared to have exited production by the manufacturer.
technicalSpecification:
$ref: '#/components/schemas/technicalSpecification'
dynamicData:
$ref: '#/components/schemas/dynamicData'
technicalSpecification:
type: object
required:
- color
- weight
- trunkVolume
- engine
- transmission
- tire
- numberOfSeats
- numberOfDoors
- fuel
- fuelCapacity
- consumption
- emissions
properties:
color:
type: string
example: "black"
description: Data on the description of the paint job of a car
weight:
type: integer
example: 1320
description: Data that specifies the total weight of a car when empty in kilograms (kg)
trunkVolume:
type: integer
example: 435
description: Data on the physical volume of the trunk in liters
engine:
type: object
required:
- type
- power
properties:
type:
type: string
example: 180 CDI
description: Data that contains the manufacturer-given type description of the engine
power:
type: integer
example: 150
description: Data on the power the engine can provide in kW
description: A physical unit that converts fuel into movement
transmission:
type: string
enum:
- MANUAL
- AUTOMATIC
example: MANUAL
description: A physical unit responsible for managing the conversion rate of the engine (can be automated or manually operated)
tire:
type: object
required:
- manufacturer
- type
properties:
manufacturer:
type: string
example: GOODYEAR
description: Data denoting the company responsible for the creation of a physical unit
type:
type: string
pattern: '^(\d{3}\/\d{2})([RD]F?)(\d{2})(\d{2,3})?(A[1-8]|[B-H]|[J-N]|[P-W]|Y)?$'
example: 185/65R15
description: Data that contains the manufacturer-given type description of the tire
description: A physical unit that serves as the point of contact between a car and the ground
numberOfSeats:
type: integer
example: 5
description: Data that defines the number of seats that are built into a car
numberOfDoors:
type: integer
example: 5
description: Data that defines the number of doors that are built into a car
fuel:
type: string
enum:
- DIESEL
- PETROL
- ELECTRIC
- HYBRID_DIESEL
- HYBRID_PETROL
example: ELECTRIC
description: Data that defines the source of energy that powers the car
fuelCapacity:
type: string
pattern: '^((\d+\.\d+L)|(\d+\.\d+kWh)|((\d+\.\d+L);(\d+\.\d+kWh)))$'
example: 54.0L;85.2kWh
description: Data that specifies the amount of fuel that can be carried with the car
consumption:
type: object
required:
- city
- combined
- overland
properties:
city:
type: number
example: 6.4
description: "Data that specifies the amount of fuel that is consumed when driving within the city in: kW/100km or l/100km"
overland:
type: number
example: 4.6
description: "Data that specifies the amount of fuel that is consumed when driving outside of a city in: kW/100km or l/100km"
combined:
type: number
example: 5.2
description: "Data that specifies the combined amount of fuel that is consumed in: kW / 100 km or l / 100 km"
description: Data that specifies the amount of fuel consumed during car operation in units per 100 kilometers
emissions:
type: object
required:
- city
- overland
- combined
properties:
city:
type: number
example: 168
description: "Data that specifies the amount of emissions when driving within the city in: g CO2 / km"
overland:
type: number
example: 122
description: "Data that specifies the amount of emissions when driving outside of a city in: g CO2 / km"
combined:
type: number
example: 137
description: "Data that specifies the combined amount of emissions in: g CO2 / km. The combination is done by the manufacturer according to an industry-specific standard"
description: Data that specifies the CO2 emitted by a car during operation in gram per kilometer
dynamicData:
type: object
required:
- fuelLevelPercentage
- position
- trunkLockState
- doorsLockState
- engineState
properties:
fuelLevelPercentage:
type: integer
example: 100
description: Data that specifies the relation of remaining fuelCapacity to the maximum fuelCapacity in percentage
position:
type: object
required:
- latitude
- longitude
properties:
latitude:
type: number
example: 42.1
description: Data that specifies the distance from the equator
longitude:
type: number
example: 100.1
description: Data that specifies the distance east or west from a line (meridian) passing through Greenwich
description: Data that specifies the GeoCoordinate of a car
trunkLockState:
$ref: '#/components/schemas/lockState'
doorsLockState:
$ref: '#/components/schemas/lockState'
engineState:
type: string
enum:
- 'ON'
- 'OFF'
description: Data that changes during a car's operation
lockState:
type: string
enum:
- LOCKED
- UNLOCKED
description: Data that specifies whether an object is locked or unlocked
vin:
type: string
pattern: '^[A-HJ-NPR-Z0-9]{13}[0-9]{4}$'
example: WDD1690071J236589
description: A Vehicle Identification Number (VIN) which uniquely identifies a car
responses:
vinInvalid:
description: The VIN has an invalid format.
carNotFound:
description: A car with the specified VIN was not found.
parameters:
vinParam:
in: path
name: vin
required: true
description: The Vehicle Identification Number (VIN) as unique number of a vehicle
example: "G1YZ23J9P58034278"
style: simple
schema:
$ref: '#/components/schemas/vin'
examples: { }
requestBodies: { }
headers: { }
securitySchemes: { }
links: { }
callbacks: { }