From 4cd065198ab71d5043e54ec21ad0b710276c34c0 Mon Sep 17 00:00:00 2001 From: "github-merge-queue[bot]" Date: Tue, 21 Jan 2025 18:41:57 +0000 Subject: [PATCH] update client/openapi/trustd.yaml Signed-off-by: GitHub --- client/openapi/trustd.yaml | 275 ++++++++++++-------- client/src/app/client/schemas.gen.ts | 352 ++++++++++++++++---------- client/src/app/client/services.gen.ts | 16 ++ client/src/app/client/types.gen.ts | 99 +++++--- 4 files changed, 469 insertions(+), 273 deletions(-) diff --git a/client/openapi/trustd.yaml b/client/openapi/trustd.yaml index ac5cc60c..afe528da 100644 --- a/client/openapi/trustd.yaml +++ b/client/openapi/trustd.yaml @@ -459,6 +459,25 @@ paths: description: The tool request was invalid '404': description: The tool was not found + /api/v2/analysis/component/{key}: + get: + tags: + - analysis + operationId: getComponent + parameters: + - name: key + in: path + description: provide component name, URL-encoded pURL, or CPE itself + required: true + schema: + type: string + responses: + '200': + description: Retrieve component(s) root components by name, pURL, or CPE. + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedResults_BaseSummary' /api/v2/analysis/dep: get: tags: @@ -503,7 +522,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DepSummary' + $ref: '#/components/schemas/PaginatedResults_DepSummary' /api/v2/analysis/dep/{key}: get: tags: @@ -522,7 +541,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DepSummary' + $ref: '#/components/schemas/PaginatedResults_DepSummary' /api/v2/analysis/root-component: get: tags: @@ -567,7 +586,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AncestorSummary' + $ref: '#/components/schemas/PaginatedResults_AncestorSummary' /api/v2/analysis/root-component/{key}: get: tags: @@ -576,17 +595,17 @@ paths: parameters: - name: key in: path - description: provide component name or URL-encoded pURL itself + description: provide component name, URL-encoded pURL, or CPE itself required: true schema: type: string responses: '200': - description: Retrieve component(s) root components by name or pURL. + description: Retrieve component(s) root components by name, pURL, or CPE. content: application/json: schema: - $ref: '#/components/schemas/AncestorSummary' + $ref: '#/components/schemas/PaginatedResults_AncestorSummary' /api/v2/analysis/status: get: tags: @@ -2413,6 +2432,44 @@ components: version: type: string AncestorSummary: + allOf: + - $ref: '#/components/schemas/BaseSummary' + - type: object + required: + - ancestors + properties: + ancestors: + type: array + items: + $ref: '#/components/schemas/AncNode' + BasePurlDetails: + allOf: + - $ref: '#/components/schemas/BasePurlHead' + - type: object + required: + - versions + properties: + versions: + type: array + items: + $ref: '#/components/schemas/VersionedPurlSummary' + BasePurlHead: + type: object + required: + - uuid + - purl + properties: + purl: + $ref: '#/components/schemas/Purl' + description: The actual base PURL + uuid: + type: string + format: uuid + description: The ID of the base PURL + BasePurlSummary: + allOf: + - $ref: '#/components/schemas/BasePurlHead' + BaseSummary: type: object required: - sbom_id @@ -2425,12 +2482,7 @@ components: - document_id - product_name - product_version - - ancestors properties: - ancestors: - type: array - items: - $ref: '#/components/schemas/AncNode' cpe: type: array items: @@ -2455,33 +2507,6 @@ components: type: string version: type: string - BasePurlDetails: - allOf: - - $ref: '#/components/schemas/BasePurlHead' - - type: object - required: - - versions - properties: - versions: - type: array - items: - $ref: '#/components/schemas/VersionedPurlSummary' - BasePurlHead: - type: object - required: - - uuid - - purl - properties: - purl: - $ref: '#/components/schemas/Purl' - description: The actual base PURL - uuid: - type: string - format: uuid - description: The ID of the base PURL - BasePurlSummary: - allOf: - - $ref: '#/components/schemas/BasePurlHead' BinaryByteSize: type: string ChatMessage: @@ -2691,48 +2716,16 @@ components: version: type: string DepSummary: - type: object - required: - - sbom_id - - node_id - - purl - - cpe - - name - - version - - published - - document_id - - product_name - - product_version - - deps - properties: - cpe: - type: array - items: - $ref: '#/components/schemas/Cpe' - deps: - type: array - items: - $ref: '#/components/schemas/DepNode' - document_id: - type: string - name: - type: string - node_id: - type: string - product_name: - type: string - product_version: - type: string - published: - type: string - purl: - type: array - items: - $ref: '#/components/schemas/Purl' - sbom_id: - type: string - version: - type: string + allOf: + - $ref: '#/components/schemas/BaseSummary' + - type: object + required: + - deps + properties: + deps: + type: array + items: + $ref: '#/components/schemas/DepNode' ExternalReferenceQuery: type: object properties: @@ -3052,6 +3045,29 @@ components: type: integer format: int64 minimum: 0 + PaginatedResults_AncestorSummary: + type: object + required: + - items + - total + properties: + items: + type: array + items: + allOf: + - $ref: '#/components/schemas/BaseSummary' + - type: object + required: + - ancestors + properties: + ancestors: + type: array + items: + $ref: '#/components/schemas/AncNode' + total: + type: integer + format: int64 + minimum: 0 PaginatedResults_BasePurlSummary: type: object required: @@ -3067,6 +3083,56 @@ components: type: integer format: int64 minimum: 0 + PaginatedResults_BaseSummary: + type: object + required: + - items + - total + properties: + items: + type: array + items: + type: object + required: + - sbom_id + - node_id + - purl + - cpe + - name + - version + - published + - document_id + - product_name + - product_version + properties: + cpe: + type: array + items: + $ref: '#/components/schemas/Cpe' + document_id: + type: string + name: + type: string + node_id: + type: string + product_name: + type: string + product_version: + type: string + published: + type: string + purl: + type: array + items: + $ref: '#/components/schemas/Purl' + sbom_id: + type: string + version: + type: string + total: + type: integer + format: int64 + minimum: 0 PaginatedResults_ConversationSummary: type: object required: @@ -3094,6 +3160,29 @@ components: type: integer format: int64 minimum: 0 + PaginatedResults_DepSummary: + type: object + required: + - items + - total + properties: + items: + type: array + items: + allOf: + - $ref: '#/components/schemas/BaseSummary' + - type: object + required: + - deps + properties: + deps: + type: array + items: + $ref: '#/components/schemas/DepNode' + total: + type: integer + format: int64 + minimum: 0 PaginatedResults_ImporterReport: type: object required: @@ -3518,7 +3607,6 @@ components: - base - advisories - licenses - - relationships properties: advisories: type: array @@ -3530,31 +3618,6 @@ components: type: array items: $ref: '#/components/schemas/PurlLicenseSummary' - relationships: - type: object - additionalProperties: - type: array - items: - type: string - propertyNames: - type: string - enum: - - contained_by - - dependency_of - - dev_dependency_of - - optional_dependency_of - - provided_dependency_of - - test_dependency_of - - runtime_dependency_of - - example_of - - generated_from - - ancestor_of - - variant_of - - build_tool_of - - dev_tool_of - - described_by - - package_of - - undefined version: $ref: '#/components/schemas/VersionedPurlHead' PurlHead: diff --git a/client/src/app/client/schemas.gen.ts b/client/src/app/client/schemas.gen.ts index 9b5bc19d..b7710dd7 100644 --- a/client/src/app/client/schemas.gen.ts +++ b/client/src/app/client/schemas.gen.ts @@ -305,6 +305,70 @@ export const AncNodeSchema = { } as const; export const AncestorSummarySchema = { + allOf: [ + { + $ref: "#/components/schemas/BaseSummary", + }, + { + type: "object", + required: ["ancestors"], + properties: { + ancestors: { + type: "array", + items: { + $ref: "#/components/schemas/AncNode", + }, + }, + }, + }, + ], +} as const; + +export const BasePurlDetailsSchema = { + allOf: [ + { + $ref: "#/components/schemas/BasePurlHead", + }, + { + type: "object", + required: ["versions"], + properties: { + versions: { + type: "array", + items: { + $ref: "#/components/schemas/VersionedPurlSummary", + }, + }, + }, + }, + ], +} as const; + +export const BasePurlHeadSchema = { + type: "object", + required: ["uuid", "purl"], + properties: { + purl: { + $ref: "#/components/schemas/Purl", + description: "The actual base PURL", + }, + uuid: { + type: "string", + format: "uuid", + description: "The ID of the base PURL", + }, + }, +} as const; + +export const BasePurlSummarySchema = { + allOf: [ + { + $ref: "#/components/schemas/BasePurlHead", + }, + ], +} as const; + +export const BaseSummarySchema = { type: "object", required: [ "sbom_id", @@ -317,15 +381,8 @@ export const AncestorSummarySchema = { "document_id", "product_name", "product_version", - "ancestors", ], properties: { - ancestors: { - type: "array", - items: { - $ref: "#/components/schemas/AncNode", - }, - }, cpe: { type: "array", items: { @@ -365,50 +422,6 @@ export const AncestorSummarySchema = { }, } as const; -export const BasePurlDetailsSchema = { - allOf: [ - { - $ref: "#/components/schemas/BasePurlHead", - }, - { - type: "object", - required: ["versions"], - properties: { - versions: { - type: "array", - items: { - $ref: "#/components/schemas/VersionedPurlSummary", - }, - }, - }, - }, - ], -} as const; - -export const BasePurlHeadSchema = { - type: "object", - required: ["uuid", "purl"], - properties: { - purl: { - $ref: "#/components/schemas/Purl", - description: "The actual base PURL", - }, - uuid: { - type: "string", - format: "uuid", - description: "The ID of the base PURL", - }, - }, -} as const; - -export const BasePurlSummarySchema = { - allOf: [ - { - $ref: "#/components/schemas/BasePurlHead", - }, - ], -} as const; - export const BinaryByteSizeSchema = { type: "string", } as const; @@ -709,64 +722,23 @@ export const DepNodeSchema = { } as const; export const DepSummarySchema = { - type: "object", - required: [ - "sbom_id", - "node_id", - "purl", - "cpe", - "name", - "version", - "published", - "document_id", - "product_name", - "product_version", - "deps", - ], - properties: { - cpe: { - type: "array", - items: { - $ref: "#/components/schemas/Cpe", - }, - }, - deps: { - type: "array", - items: { - $ref: "#/components/schemas/DepNode", - }, - }, - document_id: { - type: "string", - }, - name: { - type: "string", - }, - node_id: { - type: "string", - }, - product_name: { - type: "string", - }, - product_version: { - type: "string", - }, - published: { - type: "string", + allOf: [ + { + $ref: "#/components/schemas/BaseSummary", }, - purl: { - type: "array", - items: { - $ref: "#/components/schemas/Purl", + { + type: "object", + required: ["deps"], + properties: { + deps: { + type: "array", + items: { + $ref: "#/components/schemas/DepNode", + }, + }, }, }, - sbom_id: { - type: "string", - }, - version: { - type: "string", - }, - }, + ], } as const; export const ExternalReferenceQuerySchema = { @@ -1205,6 +1177,40 @@ export const PaginatedResults_AdvisorySummarySchema = { }, } as const; +export const PaginatedResults_AncestorSummarySchema = { + type: "object", + required: ["items", "total"], + properties: { + items: { + type: "array", + items: { + allOf: [ + { + $ref: "#/components/schemas/BaseSummary", + }, + { + type: "object", + required: ["ancestors"], + properties: { + ancestors: { + type: "array", + items: { + $ref: "#/components/schemas/AncNode", + }, + }, + }, + }, + ], + }, + }, + total: { + type: "integer", + format: "int64", + minimum: 0, + }, + }, +} as const; + export const PaginatedResults_BasePurlSummarySchema = { type: "object", required: ["items", "total"], @@ -1227,6 +1233,74 @@ export const PaginatedResults_BasePurlSummarySchema = { }, } as const; +export const PaginatedResults_BaseSummarySchema = { + type: "object", + required: ["items", "total"], + properties: { + items: { + type: "array", + items: { + type: "object", + required: [ + "sbom_id", + "node_id", + "purl", + "cpe", + "name", + "version", + "published", + "document_id", + "product_name", + "product_version", + ], + properties: { + cpe: { + type: "array", + items: { + $ref: "#/components/schemas/Cpe", + }, + }, + document_id: { + type: "string", + }, + name: { + type: "string", + }, + node_id: { + type: "string", + }, + product_name: { + type: "string", + }, + product_version: { + type: "string", + }, + published: { + type: "string", + }, + purl: { + type: "array", + items: { + $ref: "#/components/schemas/Purl", + }, + }, + sbom_id: { + type: "string", + }, + version: { + type: "string", + }, + }, + }, + }, + total: { + type: "integer", + format: "int64", + minimum: 0, + }, + }, +} as const; + export const PaginatedResults_ConversationSummarySchema = { type: "object", required: ["items", "total"], @@ -1259,6 +1333,40 @@ export const PaginatedResults_ConversationSummarySchema = { }, } as const; +export const PaginatedResults_DepSummarySchema = { + type: "object", + required: ["items", "total"], + properties: { + items: { + type: "array", + items: { + allOf: [ + { + $ref: "#/components/schemas/BaseSummary", + }, + { + type: "object", + required: ["deps"], + properties: { + deps: { + type: "array", + items: { + $ref: "#/components/schemas/DepNode", + }, + }, + }, + }, + ], + }, + }, + total: { + type: "integer", + format: "int64", + minimum: 0, + }, + }, +} as const; + export const PaginatedResults_ImporterReportSchema = { type: "object", required: ["items", "total"], @@ -1865,7 +1973,7 @@ export const PurlDetailsSchema = { }, { type: "object", - required: ["version", "base", "advisories", "licenses", "relationships"], + required: ["version", "base", "advisories", "licenses"], properties: { advisories: { type: "array", @@ -1882,36 +1990,6 @@ export const PurlDetailsSchema = { $ref: "#/components/schemas/PurlLicenseSummary", }, }, - relationships: { - type: "object", - additionalProperties: { - type: "array", - items: { - type: "string", - }, - }, - propertyNames: { - type: "string", - enum: [ - "contained_by", - "dependency_of", - "dev_dependency_of", - "optional_dependency_of", - "provided_dependency_of", - "test_dependency_of", - "runtime_dependency_of", - "example_of", - "generated_from", - "ancestor_of", - "variant_of", - "build_tool_of", - "dev_tool_of", - "described_by", - "package_of", - "undefined", - ], - }, - }, version: { $ref: "#/components/schemas/VersionedPurlHead", }, diff --git a/client/src/app/client/services.gen.ts b/client/src/app/client/services.gen.ts index ad0d8b07..3f68d342 100644 --- a/client/src/app/client/services.gen.ts +++ b/client/src/app/client/services.gen.ts @@ -53,6 +53,9 @@ import type { AiToolCallData, AiToolCallError, AiToolCallResponse, + GetComponentData, + GetComponentError, + GetComponentResponse, SearchComponentDepsData, SearchComponentDepsError, SearchComponentDepsResponse, @@ -456,6 +459,19 @@ export const aiToolCall = ( }); }; +export const getComponent = ( + options: Options +) => { + return (options?.client ?? client).get< + GetComponentResponse, + GetComponentError, + ThrowOnError + >({ + ...options, + url: "/api/v2/analysis/component/{key}", + }); +}; + export const searchComponentDeps = ( options?: Options ) => { diff --git a/client/src/app/client/types.gen.ts b/client/src/app/client/types.gen.ts index 842b22fd..2949f0cf 100644 --- a/client/src/app/client/types.gen.ts +++ b/client/src/app/client/types.gen.ts @@ -127,18 +127,8 @@ export type AncNode = { version: string; }; -export type AncestorSummary = { +export type AncestorSummary = BaseSummary & { ancestors: Array; - cpe: Array; - document_id: string; - name: string; - node_id: string; - product_name: string; - product_version: string; - published: string; - purl: Array; - sbom_id: string; - version: string; }; export type BasePurlDetails = BasePurlHead & { @@ -158,6 +148,19 @@ export type BasePurlHead = { export type BasePurlSummary = BasePurlHead; +export type BaseSummary = { + cpe: Array; + document_id: string; + name: string; + node_id: string; + product_name: string; + product_version: string; + published: string; + purl: Array; + sbom_id: string; + version: string; +}; + export type BinaryByteSize = string; export type ChatMessage = { @@ -257,18 +260,8 @@ export type DepNode = { version: string; }; -export type DepSummary = { - cpe: Array; +export type DepSummary = BaseSummary & { deps: Array; - document_id: string; - name: string; - node_id: string; - product_name: string; - product_version: string; - published: string; - purl: Array; - sbom_id: string; - version: string; }; export type ExternalReferenceQuery = { @@ -473,11 +466,36 @@ export type PaginatedResults_AdvisorySummary = { total: number; }; +export type PaginatedResults_AncestorSummary = { + items: Array< + BaseSummary & { + ancestors: Array; + } + >; + total: number; +}; + export type PaginatedResults_BasePurlSummary = { items: Array; total: number; }; +export type PaginatedResults_BaseSummary = { + items: Array<{ + cpe: Array; + document_id: string; + name: string; + node_id: string; + product_name: string; + product_version: string; + published: string; + purl: Array; + sbom_id: string; + version: string; + }>; + total: number; +}; + export type PaginatedResults_ConversationSummary = { items: Array<{ id: string; @@ -487,6 +505,15 @@ export type PaginatedResults_ConversationSummary = { total: number; }; +export type PaginatedResults_DepSummary = { + items: Array< + BaseSummary & { + deps: Array; + } + >; + total: number; +}; + export type PaginatedResults_ImporterReport = { items: Array<{ /** @@ -666,9 +693,6 @@ export type PurlDetails = PurlHead & { advisories: Array; base: BasePurlHead; licenses: Array; - relationships: { - [key: string]: Array; - }; version: VersionedPurlHead; }; @@ -1231,6 +1255,19 @@ export type AiToolCallResponse = string; export type AiToolCallError = unknown; +export type GetComponentData = { + path: { + /** + * provide component name, URL-encoded pURL, or CPE itself + */ + key: string; + }; +}; + +export type GetComponentResponse = PaginatedResults_BaseSummary; + +export type GetComponentError = unknown; + export type SearchComponentDepsData = { query?: { /** @@ -1250,7 +1287,7 @@ export type SearchComponentDepsData = { }; }; -export type SearchComponentDepsResponse = DepSummary; +export type SearchComponentDepsResponse = PaginatedResults_DepSummary; export type SearchComponentDepsError = unknown; @@ -1263,7 +1300,7 @@ export type GetComponentDepsData = { }; }; -export type GetComponentDepsResponse = DepSummary; +export type GetComponentDepsResponse = PaginatedResults_DepSummary; export type GetComponentDepsError = unknown; @@ -1286,20 +1323,22 @@ export type SearchComponentRootComponentsData = { }; }; -export type SearchComponentRootComponentsResponse = AncestorSummary; +export type SearchComponentRootComponentsResponse = + PaginatedResults_AncestorSummary; export type SearchComponentRootComponentsError = unknown; export type GetComponentRootComponentsData = { path: { /** - * provide component name or URL-encoded pURL itself + * provide component name, URL-encoded pURL, or CPE itself */ key: string; }; }; -export type GetComponentRootComponentsResponse = AncestorSummary; +export type GetComponentRootComponentsResponse = + PaginatedResults_AncestorSummary; export type GetComponentRootComponentsError = unknown;