Skip to content

Commit d35b0b1

Browse files
committed
More DRY'ing up
Signed-off-by: Viktor Petersson <self@vpetersson.com>
1 parent 7836b8c commit d35b0b1

File tree

1 file changed

+60
-89
lines changed

1 file changed

+60
-89
lines changed

spec/openapi.json

+60-89
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,9 @@
146146
"$ref": "#/components/parameters/tea_product_identifier"
147147
}
148148
],
149-
"responses": {
150-
"204": {
151-
"description": "TEA Product successfully deleted"
152-
},
153-
"401": { "$ref": "#/components/responses/401-unauthorized" },
154-
"404": {
155-
"$ref": "#/components/responses/404-object-by-id-not-found"
156-
}
157-
},
149+
"$ref": "#/components/operations/standard_delete",
158150
"tags": [
159151
"TEA Product"
160-
],
161-
"security": [
162-
{
163-
"bearerAuth": []
164-
},
165-
{
166-
"basicAuth": []
167-
}
168152
]
169153
}
170154
},
@@ -174,54 +158,22 @@
174158
"operationId": "listTeaProducts",
175159
"parameters": [
176160
{
177-
"$ref": "#/components/parameters/page-offset"
178-
},
179-
{
180-
"$ref": "#/components/parameters/page-size"
181-
},
182-
{
183-
"$ref": "#/components/parameters/purl"
184-
},
185-
{
186-
"$ref": "#/components/parameters/barcode"
187-
},
188-
{
189-
"$ref": "#/components/parameters/sku"
190-
},
191-
{
192-
"$ref": "#/components/parameters/vendor_uuid"
161+
"$ref": "#/components/parameters/standard_pagination"
193162
}
194163
],
195164
"responses": {
196165
"200": {
197-
"description": "List of TEA Products retrieved successfully",
166+
"description": "List retrieved successfully",
198167
"content": {
199168
"application/json": {
200169
"schema": {
201-
"type": "object",
202-
"properties": {
203-
"pagination": {
204-
"$ref": "#/components/schemas/type_pagination_details"
205-
},
206-
"items": {
207-
"type": "array",
208-
"items": {
209-
"$ref": "#/components/schemas/tea_product"
210-
}
211-
}
212-
},
213-
"required": [
214-
"pagination",
215-
"items"
216-
]
170+
"$ref": "#/components/schemas/paginated_product_list"
217171
}
218172
}
219173
}
220-
}
221-
},
222-
"tags": [
223-
"TEA Product"
224-
]
174+
},
175+
"$ref": "#/components/responses/standard_errors"
176+
}
225177
},
226178
"post": {
227179
"description": "Create TEA Product entry for the supplied product identifier",
@@ -523,25 +475,9 @@
523475
"$ref": "#/components/parameters/tea_leaf_identifier"
524476
}
525477
],
526-
"responses": {
527-
"204": {
528-
"description": "TEA Leaf successfully deleted"
529-
},
530-
"401": { "$ref": "#/components/responses/401-unauthorized" },
531-
"404": {
532-
"$ref": "#/components/responses/404-object-by-id-not-found"
533-
}
534-
},
478+
"$ref": "#/components/operations/standard_delete",
535479
"tags": [
536480
"TEA Leaf"
537-
],
538-
"security": [
539-
{
540-
"bearerAuth": []
541-
},
542-
{
543-
"basicAuth": []
544-
}
545481
]
546482
}
547483
},
@@ -930,25 +866,9 @@
930866
"$ref": "#/components/parameters/tea_collection_identifier"
931867
}
932868
],
933-
"responses": {
934-
"204": {
935-
"description": "TEA Collection successfully deleted"
936-
},
937-
"401": { "$ref": "#/components/responses/401-unauthorized" },
938-
"404": {
939-
"$ref": "#/components/responses/404-object-by-id-not-found"
940-
}
941-
},
869+
"$ref": "#/components/operations/standard_delete",
942870
"tags": [
943871
"TEA Collection"
944-
],
945-
"security": [
946-
{
947-
"bearerAuth": []
948-
},
949-
{
950-
"basicAuth": []
951-
}
952872
]
953873
}
954874
}
@@ -1514,6 +1434,57 @@
15141434
"type": "http",
15151435
"scheme": "basic"
15161436
}
1437+
},
1438+
"security_requirements": {
1439+
"standard_auth": [
1440+
{
1441+
"bearerAuth": []
1442+
},
1443+
{
1444+
"basicAuth": []
1445+
}
1446+
]
1447+
},
1448+
"responses": {
1449+
"standard_errors": {
1450+
"400": {
1451+
"description": "Invalid request body",
1452+
"content": {
1453+
"application/json": {}
1454+
}
1455+
},
1456+
"401": {
1457+
"$ref": "#/components/responses/401-unauthorized"
1458+
},
1459+
"404": {
1460+
"$ref": "#/components/responses/404-object-by-id-not-found"
1461+
}
1462+
},
1463+
"standard_delete": {
1464+
"204": {
1465+
"description": "Resource successfully deleted"
1466+
}
1467+
}
1468+
},
1469+
"parameters": {
1470+
"standard_pagination": {
1471+
"page_offset": {
1472+
"$ref": "#/components/parameters/page-offset"
1473+
},
1474+
"page_size": {
1475+
"$ref": "#/components/parameters/page-size"
1476+
}
1477+
}
1478+
},
1479+
"operations": {
1480+
"standard_delete": {
1481+
"responses": {
1482+
"$ref": "#/components/responses/standard_delete"
1483+
},
1484+
"security": {
1485+
"$ref": "#/components/security_requirements/standard_auth"
1486+
}
1487+
}
15171488
}
15181489
},
15191490
"security": [

0 commit comments

Comments
 (0)