Skip to content

Commit 5190f4b

Browse files
authored
Merge pull request #84 from vpetersson/dry
DRY up the file with reusable blocks.
2 parents 8574e72 + d35b0b1 commit 5190f4b

File tree

1 file changed

+173
-131
lines changed

1 file changed

+173
-131
lines changed

spec/openapi.json

+173-131
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,45 +866,22 @@
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
}
955875
},
956876
"webhooks": {},
957877
"components": {
958878
"schemas": {
959-
"tea_product": {
879+
"base_product_fields": {
960880
"type": "object",
961881
"properties": {
962-
"identifier": {
963-
"$ref": "#/components/schemas/type_uuid"
964-
},
965882
"product_name": {
966883
"type": "string"
967884
},
968-
"purl": {
969-
"type": "string",
970-
"description": "Package URL (PURL)"
971-
},
972885
"barcode": {
973886
"type": "string",
974887
"description": "Barcode"
@@ -981,59 +894,126 @@
981894
"$ref": "#/components/schemas/type_uuid",
982895
"description": "Vendor UUID"
983896
},
984-
"leaf_references": {
985-
"type": "array",
986-
"items": {
987-
"$ref": "#/components/schemas/type_uuid"
988-
},
989-
"description": "Array of UUIDs referencing TEA Leaf entries"
897+
"purl": {
898+
"type": "string",
899+
"description": "Package URL (PURL)"
900+
}
901+
}
902+
},
903+
"base_versioned_product": {
904+
"allOf": [
905+
{ "$ref": "#/components/schemas/base_product_fields" },
906+
{
907+
"type": "object",
908+
"properties": {
909+
"product_version": {
910+
"type": "string"
911+
},
912+
"release_date": {
913+
"type": "string",
914+
"format": "date-time",
915+
"example": "2024-03-20T15:30:00Z"
916+
}
917+
}
990918
}
991-
},
992-
"required": [
993-
"identifier",
994-
"product_name"
995919
]
996920
},
997-
"tea_leaf": {
921+
"base_artifact_object": {
998922
"type": "object",
999923
"properties": {
1000924
"identifier": {
1001925
"$ref": "#/components/schemas/type_uuid"
1002926
},
1003-
"product_name": {
927+
"description": {
1004928
"type": "string"
1005929
},
1006-
"product_version": {
930+
"mime_type": {
1007931
"type": "string"
1008932
},
1009-
"release_date": {
933+
"artifact_url": {
1010934
"type": "string",
1011-
"format": "date-time",
1012-
"example": "2024-03-20T15:30:00Z"
935+
"format": "uri"
1013936
},
1014-
"pre_release": {
1015-
"type": "boolean"
937+
"artifact_size_in_bytes": {
938+
"type": "integer",
939+
"format": "int64"
1016940
},
1017-
"end_of_life": {
941+
"artifact_checksum": {
1018942
"type": "string",
1019-
"format": "date-time",
1020-
"example": "2024-03-20T15:30:00Z"
943+
"description": "The checksum value"
1021944
},
1022-
"collection_references": {
1023-
"type": "array",
1024-
"items": {
1025-
"$ref": "#/components/schemas/type_uuid"
945+
"artifact_checksum_type": {
946+
"type": "string",
947+
"description": "The algorithm used to generate the checksum",
948+
"enum": [
949+
"SHA512",
950+
"SHA384",
951+
"SHA256",
952+
"SHA224",
953+
"SHA1",
954+
"MD5",
955+
"BLAKE2b-512",
956+
"BLAKE2s-256",
957+
"BLAKE3"
958+
],
959+
"default": "SHA256"
960+
}
961+
}
962+
},
963+
"tea_product": {
964+
"allOf": [
965+
{ "$ref": "#/components/schemas/base_product_fields" },
966+
{
967+
"type": "object",
968+
"properties": {
969+
"identifier": {
970+
"$ref": "#/components/schemas/type_uuid"
971+
},
972+
"leaf_references": {
973+
"type": "array",
974+
"items": {
975+
"$ref": "#/components/schemas/type_uuid"
976+
},
977+
"description": "Array of UUIDs referencing TEA Leaf entries"
978+
}
1026979
},
1027-
"description": "Array of UUIDs referencing TEA Collection entries",
1028-
"default": []
980+
"required": ["identifier", "product_name"]
981+
}
982+
]
983+
},
984+
"tea_leaf": {
985+
"allOf": [
986+
{ "$ref": "#/components/schemas/base_versioned_product" },
987+
{
988+
"type": "object",
989+
"properties": {
990+
"identifier": {
991+
"$ref": "#/components/schemas/type_uuid"
992+
},
993+
"pre_release": {
994+
"type": "boolean"
995+
},
996+
"end_of_life": {
997+
"type": "string",
998+
"format": "date-time"
999+
},
1000+
"collection_references": {
1001+
"type": "array",
1002+
"items": {
1003+
"$ref": "#/components/schemas/type_uuid"
1004+
},
1005+
"description": "Array of UUIDs referencing TEA Collection entries",
1006+
"default": []
1007+
}
1008+
},
1009+
"required": [
1010+
"identifier",
1011+
"product_name",
1012+
"product_version",
1013+
"release_date",
1014+
"pre_release"
1015+
]
10291016
}
1030-
},
1031-
"required": [
1032-
"identifier",
1033-
"product_name",
1034-
"product_version",
1035-
"release_date",
1036-
"pre_release"
10371017
]
10381018
},
10391019
"tea_collection": {
@@ -1325,6 +1305,17 @@
13251305
}
13261306
},
13271307
"responses": {
1308+
"base_error": {
1309+
"type": "object",
1310+
"properties": {
1311+
"error": {
1312+
"type": "string"
1313+
},
1314+
"message": {
1315+
"type": "string"
1316+
}
1317+
}
1318+
},
13281319
"404-object-by-id-not-found": {
13291320
"description": "Object requested by identifier not found",
13301321
"content": {
@@ -1443,6 +1434,57 @@
14431434
"type": "http",
14441435
"scheme": "basic"
14451436
}
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+
}
14461488
}
14471489
},
14481490
"security": [

0 commit comments

Comments
 (0)