Skip to content

Commit 4cf29da

Browse files
committed
#1 Add idempotency for post requests
1 parent 7ab5a49 commit 4cf29da

File tree

2 files changed

+26
-0
lines changed
  • matchmaker/api/src/main/resources/static/openapi
  • people/api/src/main/resources/static/openapi

2 files changed

+26
-0
lines changed

matchmaker/api/src/main/resources/static/openapi/api.yml

+12
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ paths:
9292
application/json:
9393
schema:
9494
$ref: "#/components/schemas/GeneralError"
95+
409:
96+
description: Attitude was already taken
97+
content:
98+
application/json:
99+
schema:
100+
$ref: "#/components/schemas/GeneralError"
95101
/people/{target_id}/attitudes/{attitude_kind}:
96102
post:
97103
tags: [SOA]
@@ -125,6 +131,12 @@ paths:
125131
application/json:
126132
schema:
127133
$ref: "#/components/schemas/GeneralError"
134+
409:
135+
description: Attitude was already taken
136+
content:
137+
application/json:
138+
schema:
139+
$ref: "#/components/schemas/GeneralError"
128140
/attitudes:
129141
delete:
130142
tags: [SOA]

people/api/src/main/resources/static/openapi/api.yml

+14
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ paths:
196196
tags: [People]
197197
summary: Create a person
198198
description: Creates a person with given parameters
199+
parameters:
200+
- name: Idempotency-Key
201+
in: header
202+
required: true
203+
schema:
204+
type: string
205+
format: uuid
206+
example: 550e8400-e29b-41d4-a716-446655440000
199207
requestBody:
200208
required: true
201209
content:
@@ -221,6 +229,12 @@ paths:
221229
application/json:
222230
schema:
223231
$ref: "#/components/schemas/GeneralError"
232+
409:
233+
description: If person was already created (Idempotency-Key duplicated)
234+
content:
235+
application/json:
236+
schema:
237+
$ref: "#/components/schemas/GeneralError"
224238
/people/{person_id}:
225239
get:
226240
tags: [People]

0 commit comments

Comments
 (0)