Skip to content

Commit 7836b8c

Browse files
committed
DRY up the file with reusable blocks.
Signed-off-by: Viktor Petersson <self@vpetersson.com>
1 parent 6b90fd4 commit 7836b8c

File tree

1 file changed

+113
-42
lines changed

1 file changed

+113
-42
lines changed

spec/openapi.json

Lines changed: 113 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -956,19 +956,12 @@
956956
"webhooks": {},
957957
"components": {
958958
"schemas": {
959-
"tea_product": {
959+
"base_product_fields": {
960960
"type": "object",
961961
"properties": {
962-
"identifier": {
963-
"$ref": "#/components/schemas/type_uuid"
964-
},
965962
"product_name": {
966963
"type": "string"
967964
},
968-
"purl": {
969-
"type": "string",
970-
"description": "Package URL (PURL)"
971-
},
972965
"barcode": {
973966
"type": "string",
974967
"description": "Barcode"
@@ -981,59 +974,126 @@
981974
"$ref": "#/components/schemas/type_uuid",
982975
"description": "Vendor UUID"
983976
},
984-
"leaf_references": {
985-
"type": "array",
986-
"items": {
987-
"$ref": "#/components/schemas/type_uuid"
988-
},
989-
"description": "Array of UUIDs referencing TEA Leaf entries"
977+
"purl": {
978+
"type": "string",
979+
"description": "Package URL (PURL)"
980+
}
981+
}
982+
},
983+
"base_versioned_product": {
984+
"allOf": [
985+
{ "$ref": "#/components/schemas/base_product_fields" },
986+
{
987+
"type": "object",
988+
"properties": {
989+
"product_version": {
990+
"type": "string"
991+
},
992+
"release_date": {
993+
"type": "string",
994+
"format": "date-time",
995+
"example": "2024-03-20T15:30:00Z"
996+
}
997+
}
990998
}
991-
},
992-
"required": [
993-
"identifier",
994-
"product_name"
995999
]
9961000
},
997-
"tea_leaf": {
1001+
"base_artifact_object": {
9981002
"type": "object",
9991003
"properties": {
10001004
"identifier": {
10011005
"$ref": "#/components/schemas/type_uuid"
10021006
},
1003-
"product_name": {
1007+
"description": {
10041008
"type": "string"
10051009
},
1006-
"product_version": {
1010+
"mime_type": {
10071011
"type": "string"
10081012
},
1009-
"release_date": {
1013+
"artifact_url": {
10101014
"type": "string",
1011-
"format": "date-time",
1012-
"example": "2024-03-20T15:30:00Z"
1015+
"format": "uri"
10131016
},
1014-
"pre_release": {
1015-
"type": "boolean"
1017+
"artifact_size_in_bytes": {
1018+
"type": "integer",
1019+
"format": "int64"
10161020
},
1017-
"end_of_life": {
1021+
"artifact_checksum": {
10181022
"type": "string",
1019-
"format": "date-time",
1020-
"example": "2024-03-20T15:30:00Z"
1023+
"description": "The checksum value"
10211024
},
1022-
"collection_references": {
1023-
"type": "array",
1024-
"items": {
1025-
"$ref": "#/components/schemas/type_uuid"
1025+
"artifact_checksum_type": {
1026+
"type": "string",
1027+
"description": "The algorithm used to generate the checksum",
1028+
"enum": [
1029+
"SHA512",
1030+
"SHA384",
1031+
"SHA256",
1032+
"SHA224",
1033+
"SHA1",
1034+
"MD5",
1035+
"BLAKE2b-512",
1036+
"BLAKE2s-256",
1037+
"BLAKE3"
1038+
],
1039+
"default": "SHA256"
1040+
}
1041+
}
1042+
},
1043+
"tea_product": {
1044+
"allOf": [
1045+
{ "$ref": "#/components/schemas/base_product_fields" },
1046+
{
1047+
"type": "object",
1048+
"properties": {
1049+
"identifier": {
1050+
"$ref": "#/components/schemas/type_uuid"
1051+
},
1052+
"leaf_references": {
1053+
"type": "array",
1054+
"items": {
1055+
"$ref": "#/components/schemas/type_uuid"
1056+
},
1057+
"description": "Array of UUIDs referencing TEA Leaf entries"
1058+
}
10261059
},
1027-
"description": "Array of UUIDs referencing TEA Collection entries",
1028-
"default": []
1060+
"required": ["identifier", "product_name"]
1061+
}
1062+
]
1063+
},
1064+
"tea_leaf": {
1065+
"allOf": [
1066+
{ "$ref": "#/components/schemas/base_versioned_product" },
1067+
{
1068+
"type": "object",
1069+
"properties": {
1070+
"identifier": {
1071+
"$ref": "#/components/schemas/type_uuid"
1072+
},
1073+
"pre_release": {
1074+
"type": "boolean"
1075+
},
1076+
"end_of_life": {
1077+
"type": "string",
1078+
"format": "date-time"
1079+
},
1080+
"collection_references": {
1081+
"type": "array",
1082+
"items": {
1083+
"$ref": "#/components/schemas/type_uuid"
1084+
},
1085+
"description": "Array of UUIDs referencing TEA Collection entries",
1086+
"default": []
1087+
}
1088+
},
1089+
"required": [
1090+
"identifier",
1091+
"product_name",
1092+
"product_version",
1093+
"release_date",
1094+
"pre_release"
1095+
]
10291096
}
1030-
},
1031-
"required": [
1032-
"identifier",
1033-
"product_name",
1034-
"product_version",
1035-
"release_date",
1036-
"pre_release"
10371097
]
10381098
},
10391099
"tea_collection": {
@@ -1325,6 +1385,17 @@
13251385
}
13261386
},
13271387
"responses": {
1388+
"base_error": {
1389+
"type": "object",
1390+
"properties": {
1391+
"error": {
1392+
"type": "string"
1393+
},
1394+
"message": {
1395+
"type": "string"
1396+
}
1397+
}
1398+
},
13281399
"404-object-by-id-not-found": {
13291400
"description": "Object requested by identifier not found",
13301401
"content": {

0 commit comments

Comments
 (0)