Skip to content

Commit c7d2ede

Browse files
authored
adding openapi spec, and updating postman collection (#12)
1 parent c2e39ef commit c7d2ede

File tree

3 files changed

+242
-14
lines changed

3 files changed

+242
-14
lines changed

openapi/openapi.yaml

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
openapi: 3.0.3
2+
info:
3+
title: User API for Speakeasy template service
4+
description: The Rest Template API is an API used for instrucitonal purposes.
5+
version: 0.1.0
6+
contact:
7+
name: Speakeasy DevRel
8+
email: nolan@speakeasyapi.dev
9+
servers:
10+
- url: http://localhost:8080
11+
paths:
12+
/v1/user:
13+
post:
14+
operationId: createUserv1
15+
summary: Create user
16+
requestBody:
17+
required: true
18+
content:
19+
application/json:
20+
schema:
21+
$ref: "#/components/schemas/User"
22+
responses:
23+
"200":
24+
content:
25+
application/json:
26+
schema:
27+
$ref: "#/components/schemas/User"
28+
description: OK
29+
default:
30+
$ref: "#/components/responses/default"
31+
/v1/user/{id}:
32+
get:
33+
operationId: getUserv1
34+
summary: Get a user by ID
35+
parameters:
36+
- in: path
37+
name: id
38+
schema:
39+
type: string
40+
required: true
41+
description: Numeric ID of the user to get
42+
responses:
43+
"200":
44+
content:
45+
application/json:
46+
schema:
47+
$ref: "#/components/schemas/User"
48+
description: OK
49+
default:
50+
$ref: "#/components/responses/default"
51+
put:
52+
operationId: updateUserv1
53+
parameters:
54+
- in: path
55+
name: id
56+
schema:
57+
type: string
58+
required: true
59+
description: UserID
60+
requestBody:
61+
required: true
62+
content:
63+
application/json:
64+
schema:
65+
$ref: "#/components/schemas/User"
66+
responses:
67+
"200":
68+
content:
69+
application/json:
70+
schema:
71+
$ref: "#/components/schemas/User"
72+
description: OK
73+
default:
74+
$ref: "#/components/responses/default"
75+
delete:
76+
operationId: deleteUserv1
77+
summary: Delete a user by ID
78+
parameters:
79+
- in: path
80+
name: id
81+
schema:
82+
type: string
83+
required: true
84+
description: UserID
85+
responses:
86+
"200":
87+
content:
88+
application/json:
89+
schema:
90+
$ref: "#/components/schemas/Success"
91+
description: OK
92+
default:
93+
$ref: "#/components/responses/default"
94+
/v1/users/search:
95+
post:
96+
operationId: searchUsersv1
97+
summary: Search users
98+
requestBody:
99+
required: true
100+
content:
101+
application/json:
102+
schema:
103+
$ref: "#/components/schemas/Filters"
104+
responses:
105+
"200":
106+
content:
107+
application/json:
108+
schema:
109+
$ref: "#/components/schemas/Users"
110+
description: OK
111+
/health:
112+
get:
113+
operationId: getHealth
114+
summary: Healthcheck
115+
responses:
116+
"200":
117+
description: OK
118+
default:
119+
$ref: "#/components/responses/default"
120+
components:
121+
responses:
122+
default:
123+
content:
124+
application/json:
125+
schema:
126+
$ref: "#/components/schemas/Error"
127+
description: Default error response
128+
schemas:
129+
Success:
130+
description: The `Status` type defines a successful response.
131+
properties:
132+
success:
133+
type: boolean
134+
type: object
135+
Error:
136+
description: The `Status` type defines a logical error model
137+
properties:
138+
message:
139+
description: A developer-facing error message.
140+
type: string
141+
status_code:
142+
description: The HTTP status code
143+
format: int32
144+
type: integer
145+
required:
146+
- message
147+
- status_code
148+
type: object
149+
Filter:
150+
description: Filters are used to query requests.
151+
properties:
152+
field:
153+
type: string
154+
matchtype:
155+
type: string
156+
value:
157+
type: string
158+
required:
159+
- field
160+
- matchtype
161+
- value
162+
type: object
163+
Filters:
164+
description: An array of filters are used to query requests.
165+
properties:
166+
filters:
167+
description: A list of filters to apply to the query.
168+
items:
169+
$ref: "#/components/schemas/Filter"
170+
type: array
171+
limit:
172+
description: The maximum number of results to return.
173+
type: integer
174+
offset:
175+
description: The offset to start the query from.
176+
type: integer
177+
required:
178+
- filters
179+
- limit
180+
- offset
181+
type: object
182+
User:
183+
description: The details of a typical user account
184+
properties:
185+
id:
186+
type: string
187+
format: uuid
188+
readOnly: true
189+
firstname:
190+
type: string
191+
lastname:
192+
type: string
193+
nickname:
194+
type: string
195+
password:
196+
type: string
197+
email:
198+
type: string
199+
format: email
200+
country:
201+
type: string
202+
createdate:
203+
format: date-time
204+
type: string
205+
readOnly: true
206+
updatedate:
207+
format: date-time
208+
type: string
209+
readOnly: true
210+
required:
211+
- firstname
212+
- lastname
213+
- nickname
214+
- password
215+
- email
216+
- country
217+
type: object
218+
Users:
219+
description: An array of users.
220+
properties:
221+
users:
222+
description: A list of users to return.
223+
items:
224+
$ref: "#/components/schemas/User"
225+
type: array
226+
required:
227+
- users
228+
type: object

postman/Bootstrap Users.postman_collection.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@
6565
}
6666
},
6767
"url": {
68-
"raw": "{{scheme}}://{{host}}{{port}}/v1/user",
68+
"raw": "{{scheme}}://{{host}}:{{port}}/v1/user",
6969
"protocol": "{{scheme}}",
7070
"host": [
71-
"{{host}}{{port}}"
71+
"{{host}}:{{port}}"
7272
],
7373
"path": [
7474
"v1",

postman/Users.postman_collection.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
}
4343
},
4444
"url": {
45-
"raw": "{{scheme}}://{{host}}{{port}}/v1/user",
45+
"raw": "{{scheme}}://{{host}}:{{port}}/v1/user",
4646
"protocol": "{{scheme}}",
4747
"host": [
48-
"{{host}}{{port}}"
48+
"{{host}}:{{port}}"
4949
],
5050
"path": [
5151
"v1",
@@ -90,10 +90,10 @@
9090
}
9191
},
9292
"url": {
93-
"raw": "{{scheme}}://{{host}}{{port}}/v1/users/search",
93+
"raw": "{{scheme}}://{{host}}:{{port}}/v1/users/search",
9494
"protocol": "{{scheme}}",
9595
"host": [
96-
"{{host}}{{port}}"
96+
"{{host}}:{{port}}"
9797
],
9898
"path": [
9999
"v1",
@@ -139,10 +139,10 @@
139139
}
140140
},
141141
"url": {
142-
"raw": "{{scheme}}://{{host}}{{port}}/v1/user/{{user_id}}",
142+
"raw": "{{scheme}}://{{host}}:{{port}}/v1/user/{{user_id}}",
143143
"protocol": "{{scheme}}",
144144
"host": [
145-
"{{host}}{{port}}"
145+
"{{host}}:{{port}}"
146146
],
147147
"path": [
148148
"v1",
@@ -191,10 +191,10 @@
191191
}
192192
},
193193
"url": {
194-
"raw": "{{scheme}}://{{host}}{{port}}/v1/user/{{user_id}}",
194+
"raw": "{{scheme}}://{{host}}:{{port}}/v1/user/{{user_id}}",
195195
"protocol": "{{scheme}}",
196196
"host": [
197-
"{{host}}{{port}}"
197+
"{{host}}:{{port}}"
198198
],
199199
"path": [
200200
"v1",
@@ -231,10 +231,10 @@
231231
}
232232
},
233233
"url": {
234-
"raw": "{{scheme}}://{{host}}{{port}}/v1/user/{{user_id}}",
234+
"raw": "{{scheme}}://{{host}}:{{port}}/v1/user/{{user_id}}",
235235
"protocol": "{{scheme}}",
236236
"host": [
237-
"{{host}}{{port}}"
237+
"{{host}}:{{port}}"
238238
],
239239
"path": [
240240
"v1",
@@ -251,10 +251,10 @@
251251
"method": "GET",
252252
"header": [],
253253
"url": {
254-
"raw": "{{scheme}}://{{host}}{{port}}/health",
254+
"raw": "{{scheme}}://{{host}}:{{port}}/health",
255255
"protocol": "{{scheme}}",
256256
"host": [
257-
"{{host}}{{port}}"
257+
"{{host}}:{{port}}"
258258
],
259259
"path": [
260260
"health"

0 commit comments

Comments
 (0)