Skip to content

Commit 2202897

Browse files
committed
Merge branch 'feature/PI-851-swagger_spec_refinement_part_2' into release/2025-03-12
2 parents 187a937 + 76df5c2 commit 2202897

File tree

4 files changed

+22
-28
lines changed

4 files changed

+22
-28
lines changed

infrastructure/swagger/05_paths.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ paths:
171171
- $ref: "#/components/parameters/ProductTeamId"
172172
responses:
173173
"400":
174-
$ref: "#/components/responses/BadRequest"
174+
$ref: "#/components/responses/CreateProductBadRequest"
175175
"200":
176176
description: "200 response"
177177
headers:
@@ -243,7 +243,7 @@ paths:
243243
- Options
244244
responses:
245245
"400":
246-
$ref: "#/components/responses/BadRequest"
246+
$ref: "#/components/responses/SearchProductBadRequest"
247247
"200":
248248
description: "200 response"
249249
headers:
@@ -307,8 +307,6 @@ paths:
307307
tags:
308308
- Options
309309
responses:
310-
"400":
311-
$ref: "#/components/responses/BadRequest"
312310
"200":
313311
description: "200 response"
314312
headers:
@@ -325,6 +323,8 @@ paths:
325323
application/json:
326324
schema:
327325
$ref: "#/components/schemas/Empty"
326+
"400":
327+
description: "400 response"
328328
x-amazon-apigateway-integration:
329329
responses:
330330
default:
@@ -374,8 +374,6 @@ paths:
374374
tags:
375375
- Options
376376
responses:
377-
"400":
378-
$ref: "#/components/responses/BadRequest"
379377
"200":
380378
description: "200 response"
381379
headers:
@@ -392,6 +390,8 @@ paths:
392390
application/json:
393391
schema:
394392
$ref: "#/components/schemas/Empty"
393+
"404":
394+
description: "404 response"
395395
x-amazon-apigateway-integration:
396396
responses:
397397
default:

infrastructure/swagger/07_components--schemas--domain.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,12 @@ components:
153153
properties:
154154
id:
155155
type: string
156-
name:
156+
cpm_product_team_id:
157157
type: string
158158
product_team_id:
159159
type: string
160+
name:
161+
type: string
160162
ods_code:
161163
type: string
162164
status:
@@ -186,6 +188,7 @@ components:
186188
cpm_product_team_id: "a9a9694d-001b-45ce-9f2a-6c9bf80ae0d0"
187189
products:
188190
- id: "P.1X3-XYZ"
191+
cpm_product_team_id: "a9a9694d-001b-45ce-9f2a-6c9bf80ae0d0"
189192
product_team_id: "55e86121-3826-468c-a6f0-dd0f1fbc0259"
190193
name: "My Great Product 1"
191194
ods_code: "F5H1R"
@@ -198,6 +201,7 @@ components:
198201
cpm_product_team_id: "152705aa-0342-487f-a654-64bba814a847"
199202
products:
200203
- id: "P.4Y6-ABC"
204+
cpm_product_team_id: "152705aa-0342-487f-a654-64bba814a847"
201205
product_team_id: "24ac1857-f718-4905-813f-52da930c3ea1"
202206
name: "My Great Product 3"
203207
ods_code: "F5H1R"

infrastructure/swagger/12_components--responses.yaml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,37 +67,23 @@ components:
6767
errors:
6868
- code: "CONFLICT"
6969
message: "Product Team cannot be deleted as it still has associated Product Ids ['P.1X3-XYZ', 'P.4Y6-ABC']"
70-
BadRequest:
71-
description: Bad request (multiple error types)
72-
content:
73-
application/json:
74-
schema:
75-
$ref: "#/components/schemas/ErrorResponse"
76-
examples:
77-
MissingValue:
78-
value:
79-
errors:
80-
- code: "MISSING_VALUE"
81-
message: "<MISSING_FIELD>: field required"
82-
- code: "MISSING_VALUE"
83-
message: "Failed to validate data against '<QUESTIONNAIRE>': '<MISSING_FIELD>' is a required property"
84-
ValidationError:
85-
value:
86-
errors:
87-
- code: "VALIDATION_ERROR"
88-
message: "Item already exists"
8970
SearchProductBadRequest:
9071
description: searchProduct Bad request
9172
content:
9273
application/json:
9374
schema:
9475
$ref: "#/components/schemas/ErrorResponse"
9576
examples:
96-
ValidationError:
77+
MissingParamValidationError:
9778
value:
9879
errors:
9980
- code: "VALIDATION_ERROR"
10081
message: "SearchProductQueryParams.__root__: Please provide exactly one valid query parameter: {'product_team_id', 'organisation_code'}."
82+
UnknownParamValidationError:
83+
value:
84+
errors:
85+
- code: "VALIDATION_ERROR"
86+
message: "SearchProductQueryParams.foo: extra fields not permitted"
10187
CreateProductTeamBadRequest:
10288
description: createProductTeam Bad request
10389
content:

scripts/infrastructure/swagger/merge.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ function generate_public_swagger() {
8888
yq 'del(.security)' |
8989
yq 'del(.paths./_status)' |
9090
yq 'del(.. | select(has("StatusOK")).StatusOK)' |
91-
yq 'del(.components.securitySchemes."${authoriser_name}")' \
91+
yq 'del(.components.securitySchemes."${authoriser_name}")' |
92+
yq 'del(.components.responses.CorsOK)' |
93+
yq 'del(.components.schemas.Empty)' |
94+
yq 'del(.tags[] | select(.name == "Options"))' |
95+
yq 'del(.paths.*.options)' \
9296
>${PUBLIC_SWAGGER_FILE}
9397
echo "Generated ${PUBLIC_SWAGGER_FILE}"
9498
validate_yaml ${PUBLIC_SWAGGER_FILE}

0 commit comments

Comments
 (0)