Skip to content

Commit 36374b5

Browse files
authored
Merge pull request #117 from madpah/fix/openapi-schema-errors
fix: Corrected various OpenAPI Spec errors to get valid Spec document
2 parents 7b401dc + 42249d2 commit 36374b5

File tree

2 files changed

+107
-140
lines changed

2 files changed

+107
-140
lines changed

.github/workflows/test-generate-api-clients.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
env:
13-
OPEN_API_GENERATOR_VERSION: 'v7.9.0'
13+
OPEN_API_GENERATOR_VERSION: 'v7.12.0'
1414
PYTHON_VERSION_DEFAULT: '3.12'
1515
POETRY_VERSION: '1.8.1'
1616

spec/openapi.yaml

Lines changed: 106 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ info:
77
description: TBC
88
contact:
99
name: TEA Working Group
10-
email: TBC
10+
1111
url: https://github.com/CycloneDX/transparency-exchange-api
1212
license:
1313
name: Apache 2.0
@@ -17,116 +17,108 @@ servers:
1717
- url: http://localhost/tea/v1
1818
description: Local development
1919
paths:
20-
"/product/uuid/{uuid}":
20+
/product/uuid/{uuid}:
2121
get:
2222
description: Returns the corresponding leafs for a given product UUID.
2323
operationId: getTeaProductByUuid
2424
parameters:
25-
- "$ref": "#/components/parameters/tei_urn"
25+
# @todo
26+
- $ref: "#/components/parameters/tei_urn"
2627
responses:
27-
'200':
28+
200:
2829
description: Requested TEA Product found and returned
2930
content:
3031
application/json:
3132
schema:
32-
"$ref": "#/components/schemas/tea_product"
33-
'404':
34-
"$ref": "#/components/responses/404-object-by-id-not-found"
33+
$ref: "#/components/schemas/tea_product"
34+
400:
35+
$ref: "#/components/responses/400-invalid-request"
36+
404:
37+
$ref: "#/components/responses/404-object-by-id-not-found"
3538
tags:
3639
- TEA Product
37-
"/product/type/{type_identifier}":
40+
/product/{product-identifier-type}/{product-identifier}:
3841
get:
3942
description: Returns a list of TEA products. Note that multiple products may
4043
match.
41-
operationId: ProductByIdentifier
44+
operationId: getTeaProductByIdentifier
4245
parameters:
43-
- name: type_identifier
44-
description: The identifier type (enum)
45-
in: path
46-
required: true
47-
schema:
48-
"$ref": "#/components/schemas/prodid_type"
49-
- name: type_val
50-
description: The actual identifier string
51-
in: query
52-
required: true
53-
schema:
54-
type: string
46+
- $ref: "#/components/parameters/product-identifier-type"
47+
- $ref: "#/components/parameters/product-identifier"
48+
- $ref: "#/components/parameters/page-offset"
49+
- $ref: "#/components/parameters/page-size"
5550
responses:
56-
'200':
51+
200:
5752
description: Product retrieved successfully
58-
content:
59-
application/json:
60-
schema:
61-
"$ref": "#/components/schemas/paginated_product_list"
62-
"$ref": "#/components/responses/standard_errors"
63-
"/leaf/{tea_leaf_identifier}":
53+
$ref: "#/components/responses/paginated-tea-product"
54+
400:
55+
$ref: "#/components/responses/400-invalid-request"
56+
404:
57+
$ref: "#/components/responses/404-object-by-id-not-found"
58+
tags:
59+
- TEA Product
60+
/leaf/{leaf-identifier}:
6461
get:
6562
description: Get the TEA Leaf that describes the Version of a Product
66-
operationId: getTeaLeaf
63+
operationId: getTeaLeafById
6764
parameters:
68-
- "$ref": "#/components/stdparameters/tea_leaf_identifier"
65+
- $ref: "#/components/parameters/leaf-identifier"
6966
responses:
70-
'200':
67+
200:
7168
description: Requested TEA Leaf found and returned
7269
content:
7370
application/json:
7471
schema:
7572
"$ref": "#/components/schemas/tea_leaf"
76-
'404':
77-
"$ref": "#/components/responses/404-object-by-id-not-found"
73+
400:
74+
$ref: "#/components/responses/400-invalid-request"
75+
404:
76+
$ref: "#/components/responses/404-object-by-id-not-found"
7877
tags:
7978
- TEA Leaf
80-
"/collection/{tea_collection_identifier}":
79+
/collection/{collection-identifier}:
8180
get:
8281
description: Get a TEA Collection by it's Identifier
83-
operationId: getTeaCollection
82+
operationId: getTeaCollectionById
8483
parameters:
85-
- "$ref": "#/components/stdparameters/tea_collection_identifier"
84+
- $ref: "#/components/parameters/collection-identifier"
8685
responses:
87-
'200':
86+
200:
8887
description: Requested TEA Collection found and returned
8988
content:
9089
application/json:
9190
schema:
9291
"$ref": "#/components/schemas/tea_collection"
93-
'404':
94-
"$ref": "#/components/responses/404-object-by-id-not-found"
92+
400:
93+
$ref: "#/components/responses/400-invalid-request"
94+
404:
95+
$ref: "#/components/responses/404-object-by-id-not-found"
9596
tags:
9697
- TEA Collection
9798
webhooks: {}
9899
components:
99100
schemas:
100-
prodid_type:
101-
type: enum
102-
description: Identifier types
103-
enum:
104-
- tei
105-
- purl
106-
- cpe
107-
type_identifier:
108-
type: object
109-
description: Declaration of an identifier
110-
properties:
111-
idtype:
112-
"$ref": "#/components/schemas/prodid_type"
113-
default: tei
114-
idvalue:
115-
description: Value of the identifier
116-
type: string
117101
base_product_fields:
118102
type: object
119103
properties:
120104
product_name:
121105
type: string
122106
description: Product name in free text.
123107
uuid:
124-
"$ref": "#/components/schemas/type_uuid"
108+
$ref": "#/components/schemas/type_uuid"
125109
description: UUID
126110
identifiers:
127111
type: array
128112
items:
129-
"$ref": "#/components/schemas/type_identifier"
113+
type: object
114+
properties:
115+
type:
116+
$ref: "#/components/schemas/type_product_identifier_type"
117+
id:
118+
type: string
119+
required:
120+
- type
121+
- id
130122
description: Array of identifiers for this product (tei, cpe, purl)
131123
base_versioned_product:
132124
allOf:
@@ -302,6 +294,7 @@ components:
302294
- artifact_size_in_bytes
303295
- artifact_checksum
304296
- artifact_checksum_type
297+
# Types
305298
type_author:
306299
type: object
307300
properties:
@@ -347,6 +340,13 @@ components:
347340
- page_start_index
348341
- page_size
349342
- total_results
343+
type_product_identifier_type:
344+
type: string
345+
description: Identifier types
346+
enum:
347+
- tei
348+
- purl
349+
- cpe
350350
type_tea_collection_artifact_type:
351351
type: string
352352
title: Type
@@ -492,34 +492,37 @@ components:
492492
type: string
493493
format: uuid
494494
responses:
495-
base_error:
496-
type: object
497-
properties:
498-
error:
499-
type: string
500-
message:
501-
type: string
502-
404-object-by-id-not-found:
503-
description: Object requested by identifier not found
495+
204-common-delete:
496+
description: Object deleted successfully
497+
content:
498+
application/json: {}
499+
400-invalid-request:
500+
description: Request was Invalid
504501
content:
505502
application/json: {}
506503
401-unauthorized:
507504
description: Authentication required
508505
content:
509506
application/json: {}
510-
standard_errors:
511-
'400':
512-
description: Invalid request body
513-
content:
514-
application/json: {}
515-
'401':
516-
"$ref": "#/components/responses/401-unauthorized"
517-
'404':
518-
"$ref": "#/components/responses/404-object-by-id-not-found"
519-
standard_delete:
520-
'204':
521-
description: Resource successfully deleted
507+
404-object-by-id-not-found:
508+
description: Object requested by identifier not found
509+
content:
510+
application/json: {}
511+
paginated-tea-product:
512+
description: A paginated response containing TEA Products
513+
content:
514+
application/json:
515+
schema:
516+
allOf:
517+
- $ref: "#/components/schemas/type_pagination_details"
518+
- type: object
519+
properties:
520+
results:
521+
type: array
522+
items:
523+
"$ref": "#/components/schemas/tea_product"
522524
parameters:
525+
# Pagination
523526
page-offset:
524527
name: page-offset
525528
description: Pagination offset
@@ -538,93 +541,57 @@ components:
538541
type: number
539542
format: int64
540543
default: 100
541-
tei_urn:
542-
name: tei_urn
543-
description: Transparency Exchange Identifier (URN)
544+
# Identifiers
545+
collection-identifier:
546+
name: collection-identifier
547+
description: TEA Collection Identifier
544548
in: path
545549
required: true
546550
schema:
547-
type: string
548-
tea_product_identifier:
549-
name: tea_product_identifier
550-
description: TEA Product Identifier
551+
$ref: "#/components/schemas/type_uuid"
552+
leaf-identifier:
553+
name: leaf-identifier
554+
description: TEA Leaf Identifier
551555
in: path
552556
required: true
553557
schema:
554-
type: string
555-
product_version:
556-
name: product_version
557-
description: Product Version string
558+
$ref: "#/components/schemas/type_uuid"
559+
product-identifier-type:
560+
name: product-identifier-type
561+
description: The identifier type (enum)
558562
in: path
559563
required: true
560564
schema:
561-
type: string
562-
tea_collection_identifier:
563-
name: tea_collection_identifier
564-
description: TEA Collection Identifier
565-
in: path
565+
$ref: "#/components/schemas/type_product_identifier_type"
566+
product-identifier:
567+
name: product-identifier
568+
description: The actual identifier string
569+
in: query
566570
required: true
567571
schema:
568572
type: string
569-
tea_leaf_identifier:
570-
name: tea_leaf_identifier
571-
description: TEA Leaf Identifier
573+
# @todo - REVIEW AS THIS IS USED AS A UUID in /product/uuid/{uuid} ??
574+
tei_urn:
575+
name: tei_urn
576+
description: Transparency Exchange Identifier (URN)
572577
in: path
573578
required: true
574579
schema:
575580
type: string
576-
purl:
577-
name: purl
578-
description: Package URL (PURL)
579-
in: query
580-
required: false
581-
schema:
582-
type: string
583-
barcode:
584-
name: barcode
585-
description: Barcode
586-
in: query
587-
required: false
588-
schema:
589-
type: string
590-
sku:
591-
name: sku
592-
description: Product SKU
593-
in: query
594-
required: false
595-
schema:
596-
type: string
597-
vendor_uuid:
598-
name: vendor_uuid
599-
description: Vendor UUID
600-
in: query
601-
required: false
602-
schema:
603-
"$ref": "#/components/schemas/type_uuid"
604581
securitySchemes:
605582
bearerAuth:
606583
type: http
607584
scheme: bearer
608585
basicAuth:
609586
type: http
610587
scheme: basic
611-
security_requirements:
612-
standard_auth:
613-
- bearerAuth: []
614-
- basicAuth: []
615-
operations:
616-
standard_delete:
617-
responses:
618-
"$ref": "#/components/responses/standard_delete"
619-
security:
620-
"$ref": "#/components/security_requirements/standard_auth"
621588
security:
622589
- bearerAuth: []
623590
- basicAuth: []
624591
tags:
625-
- TEA Collection
626-
- TEA Product
627-
- TEA Leaf
592+
- name: TEA Collection
593+
- name: TEA Product
594+
- name: TEA Leaf
628595
externalDocs:
629596
description: Transparency Exchange API specification
630597
url: https://github.com/CycloneDX/transparency-exchange-api

0 commit comments

Comments
 (0)