-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
213 lines (204 loc) · 5.79 KB
/
openapi.yaml
File metadata and controls
213 lines (204 loc) · 5.79 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
openapi: 3.0.3
info:
title: Order Tracking API
description: API for tracking and managing orders with real-time status updates.
version: v1
contact:
name: Order Tracking Team
tags:
- name: Orders
description: Operations for managing orders
paths:
/api/orders:
post:
tags:
- Orders
operationId: createOrder
summary: Creates a new order
description: Creates a new order with the given order number and description.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrderRequest'
responses:
'201':
description: Order created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponse'
'400':
description: Invalid request data
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
get:
tags:
- Orders
operationId: getOrders
summary: Gets all orders
description: Returns a list of all orders in the system.
responses:
'200':
description: A list of orders
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderResponse'
/api/orders/{id}:
get:
tags:
- Orders
operationId: getOrderById
summary: Gets an order by ID
description: Returns a single order by its unique identifier.
parameters:
- name: id
in: path
required: true
description: The unique identifier of the order
schema:
type: string
format: uuid
responses:
'200':
description: The requested order
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponse'
'404':
description: Order not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/api/orders/{id}/status:
patch:
tags:
- Orders
operationId: updateOrderStatus
summary: Updates the status of an order
description: >-
Changes the status of an existing order.
Valid transitions depend on the current status.
parameters:
- name: id
in: path
required: true
description: The unique identifier of the order
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateOrderStatusRequest'
responses:
'200':
description: Order status updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponse'
'404':
description: Order not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
'409':
description: Invalid status transition
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
components:
schemas:
CreateOrderRequest:
type: object
description: Request body for creating a new order.
required:
- orderNumber
- description
properties:
orderNumber:
type: string
description: The unique order number
example: "ORD-001"
description:
type: string
description: A description of the order
example: "Express delivery to Moscow"
UpdateOrderStatusRequest:
type: object
description: Request body for updating an order status.
required:
- status
properties:
status:
type: string
description: The new status for the order
enum:
- New
- InProgress
- Delivered
- Cancelled
example: "InProgress"
OrderResponse:
type: object
description: Represents an order in the system.
properties:
id:
type: string
format: uuid
description: The unique identifier of the order
orderNumber:
type: string
description: The order number
description:
type: string
description: The order description
status:
type: string
description: The current status of the order
enum:
- New
- InProgress
- Delivered
- Cancelled
createdAt:
type: string
format: date-time
description: The date and time when the order was created
updatedAt:
type: string
format: date-time
description: The date and time when the order was last updated
ProblemDetails:
type: object
description: RFC 7807 problem details for HTTP APIs.
properties:
type:
type: string
description: A URI reference that identifies the problem type
title:
type: string
description: A short human-readable summary of the problem
status:
type: integer
format: int32
description: The HTTP status code
detail:
type: string
description: A human-readable explanation specific to this occurrence
instance:
type: string
description: A URI reference that identifies the specific occurrence