-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenapi.yml
More file actions
180 lines (180 loc) · 5.27 KB
/
openapi.yml
File metadata and controls
180 lines (180 loc) · 5.27 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
openapi: 3.0.1
info:
title: "Restaurant Booking API"
description: "API for managing restaurant table reservations"
version: 1.0.0
servers:
- url: https://api.example.com/demo
paths:
/booking:
post:
summary: "Create a new restaurant booking"
description: "Create a new restaurant table reservation with guest details"
operationId: "createBooking"
requestBody:
description: "Details of the booking request"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BookingRequest'
responses:
"200":
description: "Successfully created booking"
content:
application/json:
schema:
$ref: '#/components/schemas/BookingSuccessResponse'
"400":
description: "Invalid input"
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
"500":
description: "Server error"
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/booking/{id}:
get:
summary: "Get booking details"
description: "Retrieve details of a specific restaurant booking"
operationId: "getBooking"
parameters:
- name: "id"
in: "path"
description: "The ID of the booking to retrieve"
required: true
schema:
type: "string"
responses:
"200":
description: "Booking details retrieved successfully"
content:
application/json:
schema:
$ref: '#/components/schemas/BookingDetails'
"400":
description: "Invalid booking ID"
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
"500":
description: "Server error"
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
summary: "Cancel booking"
description: "Cancel an existing restaurant booking"
operationId: "cancelBooking"
parameters:
- name: "id"
in: "path"
description: "The ID of the booking to cancel"
required: true
schema:
type: "string"
responses:
"200":
description: "Booking cancelled successfully"
content:
application/json:
schema:
$ref: '#/components/schemas/CancelResponse'
"400":
description: "Invalid booking ID"
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
"500":
description: "Server error"
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
BookingRequest:
type: object
required:
- date
- name
- hour
- num_guests
properties:
date:
type: string
format: date
description: "The date of the booking (YYYY-MM-DD)"
example: "2025-11-03"
name:
type: string
description: "Name to identify your reservation"
maxLength: 100
example: "John Smith"
hour:
type: string
description: "The hour of the booking (HH:MM)"
pattern: "^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$"
example: "19:30"
num_guests:
type: integer
description: "The number of guests for the booking"
minimum: 1
maximum: 20
example: 4
BookingSuccessResponse:
type: object
properties:
message:
type: string
description: "Success message with booking details"
example: "Success! Your booking on 2025-11-03 at 19:30 by John Smith for 4 guests is confirmed. Your booking ID is 7f0bdd0c."
booking_id:
type: string
description: "Unique identifier for the booking"
example: "7f0bdd0c"
BookingDetails:
type: object
properties:
booking_id:
type: string
description: "Unique identifier for the booking"
example: "7f0bdd0c"
date:
type: string
format: date
description: "The date of the booking"
example: "2025-11-03"
name:
type: string
description: "Name on the reservation"
example: "John Smith"
hour:
type: string
description: "The hour of the booking"
example: "19:30"
num_guests:
type: integer
description: "The number of guests for the booking"
example: 4
CancelResponse:
type: object
properties:
message:
type: string
description: "Success message for booking cancellation"
example: "Booking with ID 7f0bdd0c deleted successfully"
ErrorResponse:
type: object
properties:
message:
type: string
description: "Error message"
example: "Missing required parameters"