From f1fe0d4e350c04d60e6f06109ec26dcbd684e138 Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Thu, 28 Nov 2024 12:46:59 -0500 Subject: [PATCH 1/7] fix: ensure tags are handled by the generated clients Signed-off-by: aramissennyeydd --- .../{DefaultApi.client.ts => Api.client.ts} | 63 +++++++++---------- .../schema/openapi/generated/apis/index.ts | 2 +- .../package/schema/openapi/generate/client.ts | 18 +++--- .../package/schema/openapi/generate/server.ts | 5 +- .../repo-tools/src/lib/openapi/helpers.ts | 20 ++++++ .../typescript-backstage-client.yaml | 7 +-- .../{api.mustache => apis/api-all.mustache} | 21 ++++--- .../apis/index.mustache | 2 +- .../typescript-backstage-server.yaml | 7 +-- .../{api.mustache => apis/api-all.mustache} | 16 +++-- .../apis/index.mustache | 3 +- .../{DefaultApi.server.ts => Api.server.ts} | 21 +++---- .../schema/openapi/generated/apis/index.ts | 8 ++- .../src/schema/openapi/generated/router.ts | 1 + 14 files changed, 117 insertions(+), 77 deletions(-) rename packages/catalog-client/src/schema/openapi/generated/apis/{DefaultApi.client.ts => Api.client.ts} (99%) rename packages/repo-tools/templates/typescript-backstage-client/{api.mustache => apis/api-all.mustache} (95%) rename packages/repo-tools/templates/typescript-backstage-server/{api.mustache => apis/api-all.mustache} (91%) rename plugins/catalog-backend/src/schema/openapi/generated/apis/{DefaultApi.server.ts => Api.server.ts} (99%) diff --git a/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts b/packages/catalog-client/src/schema/openapi/generated/apis/Api.client.ts similarity index 99% rename from packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts rename to packages/catalog-client/src/schema/openapi/generated/apis/Api.client.ts index 11fa561e19..66a29b2bd5 100644 --- a/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts +++ b/packages/catalog-client/src/schema/openapi/generated/apis/Api.client.ts @@ -22,7 +22,6 @@ import { FetchApi } from '../types/fetch'; import crossFetch from 'cross-fetch'; import { pluginId } from '../pluginId'; import * as parser from 'uri-template'; - import { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model'; import { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model'; import { CreateLocation201Response } from '../models/CreateLocation201Response.model'; @@ -35,8 +34,8 @@ import { EntityFacetsResponse } from '../models/EntityFacetsResponse.model'; import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model'; import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; import { Location } from '../models/Location.model'; -import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; +import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; /** * Wraps the Response type to convey a type on the json call. @@ -55,7 +54,6 @@ export type TypedResponse = Omit & { export interface RequestOptions { token?: string; } - /** * @public */ @@ -186,18 +184,17 @@ export type GetLocations = {}; /** * @public */ -export type RefreshEntity = { - body: RefreshEntityRequest; +export type ValidateEntity = { + body: ValidateEntityRequest; }; /** * @public */ -export type ValidateEntity = { - body: ValidateEntityRequest; +export type RefreshEntity = { + body: RefreshEntityRequest; }; /** - * no description * @public */ export class DefaultApiClient { @@ -601,31 +598,6 @@ export class DefaultApiClient { }); } - /** - * Refresh the entity related to entityRef. - * @param refreshEntityRequest - - */ - public async refreshEntity( - // @ts-ignore - request: RefreshEntity, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/refresh`; - - const uri = parser.parse(uriTemplate).expand({}); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'POST', - body: JSON.stringify(request.body), - }); - } - /** * Validate that a passed in entity has no errors in schema. * @param validateEntityRequest - @@ -650,4 +622,29 @@ export class DefaultApiClient { body: JSON.stringify(request.body), }); } + + /** + * Refresh the entity related to entityRef. + * @param refreshEntityRequest - + */ + public async refreshEntity( + // @ts-ignore + request: RefreshEntity, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/refresh`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } } diff --git a/packages/catalog-client/src/schema/openapi/generated/apis/index.ts b/packages/catalog-client/src/schema/openapi/generated/apis/index.ts index 51dcca33fe..af52f9db46 100644 --- a/packages/catalog-client/src/schema/openapi/generated/apis/index.ts +++ b/packages/catalog-client/src/schema/openapi/generated/apis/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './DefaultApi.client'; +export * from './Api.client'; diff --git a/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts b/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts index bd8ff8530e..a207045ce0 100644 --- a/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts +++ b/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts @@ -21,11 +21,13 @@ import { OUTPUT_PATH, } from '../../../../../lib/openapi/constants'; import { paths as cliPaths } from '../../../../../lib/paths'; -import { mkdirpSync } from 'fs-extra'; import fs from 'fs-extra'; import { exec } from '../../../../../lib/exec'; import { resolvePackagePath } from '@backstage/backend-plugin-api'; -import { getPathToCurrentOpenApiSpec } from '../../../../../lib/openapi/helpers'; +import { + getPathToCurrentOpenApiSpec, + toGeneratorAdditionalProperties, +} from '../../../../../lib/openapi/helpers'; async function generate( outputDirectory: string, @@ -37,12 +39,8 @@ async function generate( outputDirectory, OUTPUT_PATH, ); - const additionalProperties = clientAdditionalProperties - ? `--additional-properties=${clientAdditionalProperties}` - : ''; - mkdirpSync(resolvedOutputDirectory); - await fs.mkdirp(resolvedOutputDirectory); + await fs.emptyDir(resolvedOutputDirectory); await fs.writeFile( resolve(resolvedOutputDirectory, '.openapi-generator-ignore'), @@ -67,7 +65,11 @@ async function generate( ), '--generator-key', 'v3.0', - additionalProperties, + '--additional-properties', + toGeneratorAdditionalProperties({ + defaultValue: { useTags: false }, + initialValue: clientAdditionalProperties, + }), ], { signal: abortSignal?.signal, diff --git a/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts b/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts index 1fbc42c175..ee52d255e9 100644 --- a/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts +++ b/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts @@ -30,6 +30,7 @@ import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { getPathToCurrentOpenApiSpec, getRelativePathToFile, + toGeneratorAdditionalProperties, } from '../../../../../lib/openapi/helpers'; async function generateSpecFile() { @@ -86,7 +87,7 @@ async function generate(abortSignal?: AbortController) { const resolvedOpenapiPath = await getPathToCurrentOpenApiSpec(); const resolvedOutputDirectory = await getRelativePathToFile(OUTPUT_PATH); - await fs.mkdirp(resolvedOutputDirectory); + await fs.emptyDir(resolvedOutputDirectory); await fs.writeFile( resolve(resolvedOutputDirectory, '.openapi-generator-ignore'), @@ -111,6 +112,8 @@ async function generate(abortSignal?: AbortController) { ), '--generator-key', 'v3.0', + '--additional-properties', + toGeneratorAdditionalProperties({ defaultValue: { useTags: false } }), ], { maxBuffer: Number.MAX_VALUE, diff --git a/packages/repo-tools/src/lib/openapi/helpers.ts b/packages/repo-tools/src/lib/openapi/helpers.ts index 2359a1bbb0..868623b874 100644 --- a/packages/repo-tools/src/lib/openapi/helpers.ts +++ b/packages/repo-tools/src/lib/openapi/helpers.ts @@ -51,3 +51,23 @@ export async function loadAndValidateOpenApiYaml(path: string) { await Parser.validate(cloneDeep(yaml) as any); return yaml; } + +export function toGeneratorAdditionalProperties({ + initialValue, + defaultValue, +}: { + initialValue?: string; + defaultValue?: Record; +}) { + const items = initialValue?.split(',') ?? []; + const parsed = items.reduce( + (acc, item) => { + const [key, value] = item.split('='); + return { ...acc, [key]: value }; + }, + { ...defaultValue }, + ); + return Object.entries(parsed) + .map(([key, value]) => `${key}=${value}`) + .join(','); +} diff --git a/packages/repo-tools/templates/typescript-backstage-client.yaml b/packages/repo-tools/templates/typescript-backstage-client.yaml index 785ffde881..dc3220f2cd 100644 --- a/packages/repo-tools/templates/typescript-backstage-client.yaml +++ b/packages/repo-tools/templates/typescript-backstage-client.yaml @@ -1,10 +1,6 @@ templateDir: templates/typescript-backstage-client files: - api.mustache: - templateType: API - # For some reason, they check for destinationFilename differences. We have to change the ending to override the file. - destinationFilename: .client.ts model.mustache: templateType: Model destinationFilename: .model.ts @@ -32,6 +28,9 @@ files: apis/index.mustache: templateType: SupportingFiles destinationFilename: apis/index.ts + apis/api-all.mustache: + templateType: SupportingFiles + destinationFilename: apis/Api.client.ts pluginId.mustache: templateType: SupportingFiles destinationFilename: pluginId.ts diff --git a/packages/repo-tools/templates/typescript-backstage-client/api.mustache b/packages/repo-tools/templates/typescript-backstage-client/apis/api-all.mustache similarity index 95% rename from packages/repo-tools/templates/typescript-backstage-client/api.mustache rename to packages/repo-tools/templates/typescript-backstage-client/apis/api-all.mustache index ee8ea4d17e..edf2e55a36 100644 --- a/packages/repo-tools/templates/typescript-backstage-client/api.mustache +++ b/packages/repo-tools/templates/typescript-backstage-client/apis/api-all.mustache @@ -4,10 +4,12 @@ import { FetchApi } from '../types/fetch'; import crossFetch from 'cross-fetch'; import {pluginId} from '../pluginId'; import * as parser from 'uri-template'; - +{{#apiInfo}} +{{#apis}} {{#imports}} import { {{classname}} } from '{{filename}}.model{{importFileExtension}}'; {{/imports}} +{{/apis}} /** * Wraps the Response type to convey a type on the json call. @@ -18,8 +20,6 @@ export type TypedResponse = Omit & { json: () => Promise; }; -{{#operations}} - /** * Options you can pass into a request for additional information. * @@ -28,7 +28,8 @@ export type TypedResponse = Omit & { export interface RequestOptions { token?: string; } - +{{#apis}} +{{#operations}} {{#operation}} /** * @public @@ -62,12 +63,13 @@ export type {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}} = { {{/hasHeaderParams}} } {{/operation}} +{{/operations}} +{{/apis}} /** - * {{{description}}}{{^description}}no description{{/description}} * @public */ -export class {{classname}}Client { +export class DefaultApiClient { private readonly discoveryApi: DiscoveryApi; private readonly fetchApi: FetchApi; @@ -79,6 +81,9 @@ export class {{classname}}Client { this.fetchApi = options.fetchApi || { fetch: crossFetch }; } + {{#apis}} + {{#operations}} + {{#operation}} /** {{#notes}} @@ -123,5 +128,7 @@ export class {{classname}}Client { } {{/operation}} + {{/operations}} + {{/apis}} } -{{/operations}} +{{/apiInfo}} \ No newline at end of file diff --git a/packages/repo-tools/templates/typescript-backstage-client/apis/index.mustache b/packages/repo-tools/templates/typescript-backstage-client/apis/index.mustache index 4c8996c5ee..ec61c280a8 100644 --- a/packages/repo-tools/templates/typescript-backstage-client/apis/index.mustache +++ b/packages/repo-tools/templates/typescript-backstage-client/apis/index.mustache @@ -1,3 +1,3 @@ // -export * from './DefaultApi.client'; +export * from './Api.client'; diff --git a/packages/repo-tools/templates/typescript-backstage-server.yaml b/packages/repo-tools/templates/typescript-backstage-server.yaml index e9140d0bc6..59d6c07c10 100644 --- a/packages/repo-tools/templates/typescript-backstage-server.yaml +++ b/packages/repo-tools/templates/typescript-backstage-server.yaml @@ -1,13 +1,12 @@ templateDir: templates/typescript-backstage-server files: - api.mustache: - templateType: API - # For some reason, they check for destinationFilename differences. We have to change the ending to override the file. - destinationFilename: .server.ts apis/index.mustache: templateType: SupportingFiles destinationFilename: apis/index.ts + apis/api-all.mustache: + templateType: SupportingFiles + destinationFilename: apis/Api.server.ts index.mustache: templateType: SupportingFiles destinationFilename: index.ts diff --git a/packages/repo-tools/templates/typescript-backstage-server/api.mustache b/packages/repo-tools/templates/typescript-backstage-server/apis/api-all.mustache similarity index 91% rename from packages/repo-tools/templates/typescript-backstage-server/api.mustache rename to packages/repo-tools/templates/typescript-backstage-server/apis/api-all.mustache index fd27bb94fa..30770d6481 100644 --- a/packages/repo-tools/templates/typescript-backstage-server/api.mustache +++ b/packages/repo-tools/templates/typescript-backstage-server/apis/api-all.mustache @@ -1,4 +1,7 @@ +// {{>licenseInfo}} +{{#apiInfo}} +{{#apis}} {{#imports}} import { {{classname}} } from '{{filename}}.model{{importFileExtension}}'; {{/imports}} @@ -39,16 +42,19 @@ export type {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}} = { response: {{#responses}} {{{dataType}}}{{^dataType}}void{{/dataType}} {{^-last}} | {{/-last}} {{/responses}} } {{/operation}} - -/** - * {{{description}}}{{^description}}no description{{/description}} - */ +{{/operations}} +{{/apis}} export type EndpointMap = { + {{#apis}} + {{#operations}} {{#operation}} '#{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}|{{path}}': {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}}, {{/operation}} + {{/operations}} + {{/apis}} } -{{/operations}} + +{{/apiInfo}} \ No newline at end of file diff --git a/packages/repo-tools/templates/typescript-backstage-server/apis/index.mustache b/packages/repo-tools/templates/typescript-backstage-server/apis/index.mustache index d0638a7538..fb39a63a46 100644 --- a/packages/repo-tools/templates/typescript-backstage-server/apis/index.mustache +++ b/packages/repo-tools/templates/typescript-backstage-server/apis/index.mustache @@ -1,3 +1,4 @@ // +{{>licenseInfo}} -export * from './DefaultApi.server'; +export * from './Api.server' \ No newline at end of file diff --git a/plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts b/plugins/catalog-backend/src/schema/openapi/generated/apis/Api.server.ts similarity index 99% rename from plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts rename to plugins/catalog-backend/src/schema/openapi/generated/apis/Api.server.ts index 8789eee1f6..d9c016a421 100644 --- a/plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts +++ b/plugins/catalog-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +// + // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** @@ -29,7 +31,6 @@ import { EntityFacetsResponse } from '../models/EntityFacetsResponse.model'; import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model'; import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; import { Location } from '../models/Location.model'; -import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; import { ValidateEntity400Response } from '../models/ValidateEntity400Response.model'; import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; @@ -175,13 +176,6 @@ export type GetLocationByEntity = { export type GetLocations = { response: Array | Error; }; -/** - * @public - */ -export type RefreshEntity = { - body: RefreshEntityRequest; - response: void | Error | Error; -}; /** * @public */ @@ -189,10 +183,15 @@ export type ValidateEntity = { body: ValidateEntityRequest; response: void | ValidateEntity400Response; }; +import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; /** - * no description + * @public */ +export type RefreshEntity = { + body: RefreshEntityRequest; + response: void | Error | Error; +}; export type EndpointMap = { '#post|/analyze-location': AnalyzeLocation; @@ -223,7 +222,7 @@ export type EndpointMap = { '#get|/locations': GetLocations; - '#post|/refresh': RefreshEntity; - '#post|/validate-entity': ValidateEntity; + + '#post|/refresh': RefreshEntity; }; diff --git a/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts b/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts index 79855a6fc8..a3cdbbebd2 100644 --- a/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts +++ b/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts @@ -14,4 +14,10 @@ * limitations under the License. */ -export * from './DefaultApi.server'; +// + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +export * from './Api.server'; diff --git a/plugins/catalog-backend/src/schema/openapi/generated/router.ts b/plugins/catalog-backend/src/schema/openapi/generated/router.ts index 8712625653..16b094c73f 100644 --- a/plugins/catalog-backend/src/schema/openapi/generated/router.ts +++ b/plugins/catalog-backend/src/schema/openapi/generated/router.ts @@ -788,6 +788,7 @@ export const spec = { '/refresh': { post: { operationId: 'RefreshEntity', + tags: ['Entity'], description: 'Refresh the entity related to entityRef.', responses: { '200': { From 860e3b557e1459fdcdcffb9090cb1973632acde9 Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Thu, 28 Nov 2024 12:51:10 -0500 Subject: [PATCH 2/7] add changeset Signed-off-by: aramissennyeydd --- .changeset/hungry-hairs-wait.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/hungry-hairs-wait.md diff --git a/.changeset/hungry-hairs-wait.md b/.changeset/hungry-hairs-wait.md new file mode 100644 index 0000000000..ed4cd01ac7 --- /dev/null +++ b/.changeset/hungry-hairs-wait.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +Generated OpenAPI clients now support paths with tags. From cb87765e50c21c9ebc33959cea500b49d8e429fe Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Thu, 28 Nov 2024 13:15:10 -0500 Subject: [PATCH 3/7] only add additional properties when necessary Signed-off-by: aramissennyeydd --- .../package/schema/openapi/generate/client.ts | 11 ++++++----- .../package/schema/openapi/generate/server.ts | 3 --- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts b/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts index a207045ce0..edcb49a9be 100644 --- a/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts +++ b/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts @@ -39,6 +39,9 @@ async function generate( outputDirectory, OUTPUT_PATH, ); + const additionalProperties = toGeneratorAdditionalProperties({ + initialValue: clientAdditionalProperties, + }); await fs.emptyDir(resolvedOutputDirectory); @@ -65,11 +68,9 @@ async function generate( ), '--generator-key', 'v3.0', - '--additional-properties', - toGeneratorAdditionalProperties({ - defaultValue: { useTags: false }, - initialValue: clientAdditionalProperties, - }), + additionalProperties + ? `--additional-properties=${additionalProperties}` + : '', ], { signal: abortSignal?.signal, diff --git a/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts b/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts index ee52d255e9..8c342b0a68 100644 --- a/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts +++ b/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts @@ -30,7 +30,6 @@ import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { getPathToCurrentOpenApiSpec, getRelativePathToFile, - toGeneratorAdditionalProperties, } from '../../../../../lib/openapi/helpers'; async function generateSpecFile() { @@ -112,8 +111,6 @@ async function generate(abortSignal?: AbortController) { ), '--generator-key', 'v3.0', - '--additional-properties', - toGeneratorAdditionalProperties({ defaultValue: { useTags: false } }), ], { maxBuffer: Number.MAX_VALUE, From ad80801d99a1209418787ce5060ef56ac26dbf62 Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Thu, 28 Nov 2024 13:16:08 -0500 Subject: [PATCH 4/7] revert catalog changes Signed-off-by: aramissennyeydd --- .../generated/apis/DefaultApi.client.ts | 653 ++++++++++++++++++ .../schema/openapi/generated/apis/index.ts | 2 +- .../generated/apis/DefaultApi.server.ts | 229 ++++++ .../schema/openapi/generated/apis/index.ts | 8 +- .../src/schema/openapi/generated/router.ts | 1 - 5 files changed, 884 insertions(+), 9 deletions(-) create mode 100644 packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts create mode 100644 plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts diff --git a/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts b/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts new file mode 100644 index 0000000000..11fa561e19 --- /dev/null +++ b/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts @@ -0,0 +1,653 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DiscoveryApi } from '../types/discovery'; +import { FetchApi } from '../types/fetch'; +import crossFetch from 'cross-fetch'; +import { pluginId } from '../pluginId'; +import * as parser from 'uri-template'; + +import { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model'; +import { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model'; +import { CreateLocation201Response } from '../models/CreateLocation201Response.model'; +import { CreateLocationRequest } from '../models/CreateLocationRequest.model'; +import { EntitiesBatchResponse } from '../models/EntitiesBatchResponse.model'; +import { EntitiesQueryResponse } from '../models/EntitiesQueryResponse.model'; +import { Entity } from '../models/Entity.model'; +import { EntityAncestryResponse } from '../models/EntityAncestryResponse.model'; +import { EntityFacetsResponse } from '../models/EntityFacetsResponse.model'; +import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model'; +import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; +import { Location } from '../models/Location.model'; +import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; +import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; + +/** + * Wraps the Response type to convey a type on the json call. + * + * @public + */ +export type TypedResponse = Omit & { + json: () => Promise; +}; + +/** + * Options you can pass into a request for additional information. + * + * @public + */ +export interface RequestOptions { + token?: string; +} + +/** + * @public + */ +export type AnalyzeLocation = { + body: AnalyzeLocationRequest; +}; +/** + * @public + */ +export type CreateLocation = { + body: CreateLocationRequest; + query: { + dryRun?: string; + }; +}; +/** + * @public + */ +export type DeleteEntityByUid = { + path: { + uid: string; + }; +}; +/** + * @public + */ +export type DeleteLocation = { + path: { + id: string; + }; +}; +/** + * @public + */ +export type GetEntities = { + query: { + fields?: Array; + limit?: number; + filter?: Array; + offset?: number; + after?: string; + order?: Array; + }; +}; +/** + * @public + */ +export type GetEntitiesByQuery = { + query: { + fields?: Array; + limit?: number; + offset?: number; + orderField?: Array; + cursor?: string; + filter?: Array; + fullTextFilterTerm?: string; + fullTextFilterFields?: Array; + }; +}; +/** + * @public + */ +export type GetEntitiesByRefs = { + body: GetEntitiesByRefsRequest; + query: { + filter?: Array; + }; +}; +/** + * @public + */ +export type GetEntityAncestryByName = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; +/** + * @public + */ +export type GetEntityByName = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; +/** + * @public + */ +export type GetEntityByUid = { + path: { + uid: string; + }; +}; +/** + * @public + */ +export type GetEntityFacets = { + query: { + facet: Array; + filter?: Array; + }; +}; +/** + * @public + */ +export type GetLocation = { + path: { + id: string; + }; +}; +/** + * @public + */ +export type GetLocationByEntity = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; +/** + * @public + */ +export type GetLocations = {}; +/** + * @public + */ +export type RefreshEntity = { + body: RefreshEntityRequest; +}; +/** + * @public + */ +export type ValidateEntity = { + body: ValidateEntityRequest; +}; + +/** + * no description + * @public + */ +export class DefaultApiClient { + private readonly discoveryApi: DiscoveryApi; + private readonly fetchApi: FetchApi; + + constructor(options: { + discoveryApi: { getBaseUrl(pluginId: string): Promise }; + fetchApi?: { fetch: typeof fetch }; + }) { + this.discoveryApi = options.discoveryApi; + this.fetchApi = options.fetchApi || { fetch: crossFetch }; + } + + /** + * Validate a given location. + * @param analyzeLocationRequest - + */ + public async analyzeLocation( + // @ts-ignore + request: AnalyzeLocation, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/analyze-location`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Create a location for a given target. + * @param createLocationRequest - + * @param dryRun - + */ + public async createLocation( + // @ts-ignore + request: CreateLocation, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/locations{?dryRun}`; + + const uri = parser.parse(uriTemplate).expand({ + ...request.query, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Delete a single entity by UID. + * @param uid - + */ + public async deleteEntityByUid( + // @ts-ignore + request: DeleteEntityByUid, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/entities/by-uid/{uid}`; + + const uri = parser.parse(uriTemplate).expand({ + uid: request.path.uid, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'DELETE', + }); + } + + /** + * Delete a location by id. + * @param id - + */ + public async deleteLocation( + // @ts-ignore + request: DeleteLocation, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/locations/{id}`; + + const uri = parser.parse(uriTemplate).expand({ + id: request.path.id, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'DELETE', + }); + } + + /** + * Get all entities matching a given filter. + * @param fields - Restrict to just these fields in the response. + * @param limit - Number of records to return in the response. + * @param filter - Filter for just the entities defined by this filter. + * @param offset - Number of records to skip in the query page. + * @param after - Pointer to the previous page of results. + * @param order - + */ + public async getEntities( + // @ts-ignore + request: GetEntities, + options?: RequestOptions, + ): Promise>> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/entities{?fields,limit,filter*,offset,after,order*}`; + + const uri = parser.parse(uriTemplate).expand({ + ...request.query, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Search for entities by a given query. + * @param fields - Restrict to just these fields in the response. + * @param limit - Number of records to return in the response. + * @param offset - Number of records to skip in the query page. + * @param orderField - The fields to sort returned results by. + * @param cursor - Cursor to a set page of results. + * @param filter - Filter for just the entities defined by this filter. + * @param fullTextFilterTerm - Text search term. + * @param fullTextFilterFields - A comma separated list of fields to sort returned results by. + */ + public async getEntitiesByQuery( + // @ts-ignore + request: GetEntitiesByQuery, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/entities/by-query{?fields,limit,offset,orderField*,cursor,filter*,fullTextFilterTerm,fullTextFilterFields}`; + + const uri = parser.parse(uriTemplate).expand({ + ...request.query, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get a batch set of entities given an array of entityRefs. + * @param filter - Filter for just the entities defined by this filter. + * @param getEntitiesByRefsRequest - + */ + public async getEntitiesByRefs( + // @ts-ignore + request: GetEntitiesByRefs, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/entities/by-refs{?filter*}`; + + const uri = parser.parse(uriTemplate).expand({ + ...request.query, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Get an entity's ancestry by entity ref. + * @param kind - + * @param namespace - + * @param name - + */ + public async getEntityAncestryByName( + // @ts-ignore + request: GetEntityAncestryByName, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}/ancestry`; + + const uri = parser.parse(uriTemplate).expand({ + kind: request.path.kind, + namespace: request.path.namespace, + name: request.path.name, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get an entity by an entity ref. + * @param kind - + * @param namespace - + * @param name - + */ + public async getEntityByName( + // @ts-ignore + request: GetEntityByName, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}`; + + const uri = parser.parse(uriTemplate).expand({ + kind: request.path.kind, + namespace: request.path.namespace, + name: request.path.name, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get a single entity by the UID. + * @param uid - + */ + public async getEntityByUid( + // @ts-ignore + request: GetEntityByUid, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/entities/by-uid/{uid}`; + + const uri = parser.parse(uriTemplate).expand({ + uid: request.path.uid, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get all entity facets that match the given filters. + * @param facet - + * @param filter - Filter for just the entities defined by this filter. + */ + public async getEntityFacets( + // @ts-ignore + request: GetEntityFacets, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/entity-facets{?facet*,filter*}`; + + const uri = parser.parse(uriTemplate).expand({ + ...request.query, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get a location by id. + * @param id - + */ + public async getLocation( + // @ts-ignore + request: GetLocation, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/locations/{id}`; + + const uri = parser.parse(uriTemplate).expand({ + id: request.path.id, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get a location for entity. + * @param kind - + * @param namespace - + * @param name - + */ + public async getLocationByEntity( + // @ts-ignore + request: GetLocationByEntity, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/locations/by-entity/{kind}/{namespace}/{name}`; + + const uri = parser.parse(uriTemplate).expand({ + kind: request.path.kind, + namespace: request.path.namespace, + name: request.path.name, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get all locations + */ + public async getLocations( + // @ts-ignore + request: GetLocations, + options?: RequestOptions, + ): Promise>> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/locations`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Refresh the entity related to entityRef. + * @param refreshEntityRequest - + */ + public async refreshEntity( + // @ts-ignore + request: RefreshEntity, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/refresh`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Validate that a passed in entity has no errors in schema. + * @param validateEntityRequest - + */ + public async validateEntity( + // @ts-ignore + request: ValidateEntity, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/validate-entity`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } +} diff --git a/packages/catalog-client/src/schema/openapi/generated/apis/index.ts b/packages/catalog-client/src/schema/openapi/generated/apis/index.ts index af52f9db46..51dcca33fe 100644 --- a/packages/catalog-client/src/schema/openapi/generated/apis/index.ts +++ b/packages/catalog-client/src/schema/openapi/generated/apis/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './Api.client'; +export * from './DefaultApi.client'; diff --git a/plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts b/plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts new file mode 100644 index 0000000000..8789eee1f6 --- /dev/null +++ b/plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts @@ -0,0 +1,229 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model'; +import { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model'; +import { CreateLocation201Response } from '../models/CreateLocation201Response.model'; +import { CreateLocationRequest } from '../models/CreateLocationRequest.model'; +import { EntitiesBatchResponse } from '../models/EntitiesBatchResponse.model'; +import { EntitiesQueryResponse } from '../models/EntitiesQueryResponse.model'; +import { Entity } from '../models/Entity.model'; +import { EntityAncestryResponse } from '../models/EntityAncestryResponse.model'; +import { EntityFacetsResponse } from '../models/EntityFacetsResponse.model'; +import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model'; +import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; +import { Location } from '../models/Location.model'; +import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; +import { ValidateEntity400Response } from '../models/ValidateEntity400Response.model'; +import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; + +/** + * @public + */ +export type AnalyzeLocation = { + body: AnalyzeLocationRequest; + response: AnalyzeLocationResponse | Error | Error; +}; +/** + * @public + */ +export type CreateLocation = { + body: CreateLocationRequest; + query: { + dryRun?: string; + }; + response: CreateLocation201Response | Error | Error; +}; +/** + * @public + */ +export type DeleteEntityByUid = { + path: { + uid: string; + }; + response: void | Error | Error; +}; +/** + * @public + */ +export type DeleteLocation = { + path: { + id: string; + }; + response: void | Error | Error; +}; +/** + * @public + */ +export type GetEntities = { + query: { + fields?: Array; + limit?: number; + filter?: Array; + offset?: number; + after?: string; + order?: Array; + }; + response: Array | Error | Error; +}; +/** + * @public + */ +export type GetEntitiesByQuery = { + query: { + fields?: Array; + limit?: number; + offset?: number; + orderField?: Array; + cursor?: string; + filter?: Array; + fullTextFilterTerm?: string; + fullTextFilterFields?: Array; + }; + response: EntitiesQueryResponse | Error | Error; +}; +/** + * @public + */ +export type GetEntitiesByRefs = { + body: GetEntitiesByRefsRequest; + query: { + filter?: Array; + }; + response: EntitiesBatchResponse | Error | Error; +}; +/** + * @public + */ +export type GetEntityAncestryByName = { + path: { + kind: string; + namespace: string; + name: string; + }; + response: EntityAncestryResponse | Error | Error; +}; +/** + * @public + */ +export type GetEntityByName = { + path: { + kind: string; + namespace: string; + name: string; + }; + response: Entity | Error | Error; +}; +/** + * @public + */ +export type GetEntityByUid = { + path: { + uid: string; + }; + response: Entity | Error | Error; +}; +/** + * @public + */ +export type GetEntityFacets = { + query: { + facet: Array; + filter?: Array; + }; + response: EntityFacetsResponse | Error | Error; +}; +/** + * @public + */ +export type GetLocation = { + path: { + id: string; + }; + response: Location | Error; +}; +/** + * @public + */ +export type GetLocationByEntity = { + path: { + kind: string; + namespace: string; + name: string; + }; + response: Location | Error; +}; +/** + * @public + */ +export type GetLocations = { + response: Array | Error; +}; +/** + * @public + */ +export type RefreshEntity = { + body: RefreshEntityRequest; + response: void | Error | Error; +}; +/** + * @public + */ +export type ValidateEntity = { + body: ValidateEntityRequest; + response: void | ValidateEntity400Response; +}; + +/** + * no description + */ + +export type EndpointMap = { + '#post|/analyze-location': AnalyzeLocation; + + '#post|/locations': CreateLocation; + + '#_delete|/entities/by-uid/{uid}': DeleteEntityByUid; + + '#_delete|/locations/{id}': DeleteLocation; + + '#get|/entities': GetEntities; + + '#get|/entities/by-query': GetEntitiesByQuery; + + '#post|/entities/by-refs': GetEntitiesByRefs; + + '#get|/entities/by-name/{kind}/{namespace}/{name}/ancestry': GetEntityAncestryByName; + + '#get|/entities/by-name/{kind}/{namespace}/{name}': GetEntityByName; + + '#get|/entities/by-uid/{uid}': GetEntityByUid; + + '#get|/entity-facets': GetEntityFacets; + + '#get|/locations/{id}': GetLocation; + + '#get|/locations/by-entity/{kind}/{namespace}/{name}': GetLocationByEntity; + + '#get|/locations': GetLocations; + + '#post|/refresh': RefreshEntity; + + '#post|/validate-entity': ValidateEntity; +}; diff --git a/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts b/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts index a3cdbbebd2..79855a6fc8 100644 --- a/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts +++ b/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts @@ -14,10 +14,4 @@ * limitations under the License. */ -// - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -export * from './Api.server'; +export * from './DefaultApi.server'; diff --git a/plugins/catalog-backend/src/schema/openapi/generated/router.ts b/plugins/catalog-backend/src/schema/openapi/generated/router.ts index 16b094c73f..8712625653 100644 --- a/plugins/catalog-backend/src/schema/openapi/generated/router.ts +++ b/plugins/catalog-backend/src/schema/openapi/generated/router.ts @@ -788,7 +788,6 @@ export const spec = { '/refresh': { post: { operationId: 'RefreshEntity', - tags: ['Entity'], description: 'Refresh the entity related to entityRef.', responses: { '200': { From 4729dafc1bc4d5c7c843727a81e616ce63ab9667 Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Thu, 28 Nov 2024 16:19:39 -0500 Subject: [PATCH 5/7] update all generated clients Signed-off-by: aramissennyeydd --- .../openapi/generated/apis/Api.client.ts | 60 +- .../generated/apis/DefaultApi.client.ts | 653 ------------------ .../schema/openapi/generated/apis/index.ts | 2 +- .../openapi/generated/apis/Api.server.ts | 21 +- .../generated/apis/DefaultApi.server.ts | 229 ------ .../schema/openapi/generated/apis/index.ts | 8 +- .../openapi/generated/apis/Api.server.ts | 59 ++ .../schema/openapi/generated/apis/index.ts | 23 + .../src/schema/openapi/generated/index.ts | 18 + .../generated/models/ErrorError.model.ts | 27 + .../generated/models/ErrorRequest.model.ts | 27 + .../generated/models/ErrorResponse.model.ts | 26 + .../openapi/generated/models/Event.model.ts | 33 + .../GetSubscriptionEvents200Response.model.ts | 27 + .../generated/models/ModelError.model.ts | 31 + .../models/PostEventRequest.model.ts | 31 + .../models/PutSubscriptionRequest.model.ts | 29 + .../schema/openapi/generated/models/index.ts | 24 + .../generated/router.ts} | 13 +- .../src/schema/openapi/index.ts | 17 + .../openapi/generated/apis/Api.client.ts | 163 +++++ .../schema/openapi/generated/apis/index.ts | 17 + .../src/schema/openapi/generated/index.ts | 18 + .../generated/models/ErrorError.model.ts | 27 + .../generated/models/ErrorRequest.model.ts | 27 + .../generated/models/ErrorResponse.model.ts | 26 + .../openapi/generated/models/Event.model.ts | 33 + .../GetSubscriptionEvents200Response.model.ts | 27 + .../generated/models/ModelError.model.ts | 31 + .../models/PostEventRequest.model.ts | 31 + .../models/PutSubscriptionRequest.model.ts | 29 + .../schema/openapi/generated/models/index.ts | 24 + .../src/schema/openapi/generated/pluginId.ts | 17 + .../openapi/generated/types/discovery.ts | 22 + .../schema/openapi/generated/types/fetch.ts | 22 + .../events-node/src/schema/openapi/index.ts | 17 + .../search-backend/src/schema/openapi.yaml | 2 +- .../{DefaultApi.server.ts => Api.server.ts} | 7 +- .../schema/openapi/generated/apis/index.ts | 8 +- .../src/schema/openapi/generated/router.ts | 2 +- 40 files changed, 973 insertions(+), 935 deletions(-) delete mode 100644 packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts delete mode 100644 plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/apis/Api.server.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/apis/index.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/index.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/ErrorError.model.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/Event.model.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/GetSubscriptionEvents200Response.model.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/ModelError.model.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/PostEventRequest.model.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/PutSubscriptionRequest.model.ts create mode 100644 plugins/events-backend/src/schema/openapi/generated/models/index.ts rename plugins/events-backend/src/schema/{openapi.generated.ts => openapi/generated/router.ts} (95%) create mode 100644 plugins/events-backend/src/schema/openapi/index.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/apis/Api.client.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/apis/index.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/index.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/ErrorError.model.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/ErrorRequest.model.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/ErrorResponse.model.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/Event.model.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/GetSubscriptionEvents200Response.model.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/ModelError.model.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/PostEventRequest.model.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/PutSubscriptionRequest.model.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/models/index.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/pluginId.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/types/discovery.ts create mode 100644 plugins/events-node/src/schema/openapi/generated/types/fetch.ts create mode 100644 plugins/events-node/src/schema/openapi/index.ts rename plugins/search-backend/src/schema/openapi/generated/apis/{DefaultApi.server.ts => Api.server.ts} (96%) diff --git a/packages/catalog-client/src/schema/openapi/generated/apis/Api.client.ts b/packages/catalog-client/src/schema/openapi/generated/apis/Api.client.ts index 66a29b2bd5..1bf554672c 100644 --- a/packages/catalog-client/src/schema/openapi/generated/apis/Api.client.ts +++ b/packages/catalog-client/src/schema/openapi/generated/apis/Api.client.ts @@ -34,8 +34,8 @@ import { EntityFacetsResponse } from '../models/EntityFacetsResponse.model'; import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model'; import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; import { Location } from '../models/Location.model'; -import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; +import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; /** * Wraps the Response type to convey a type on the json call. @@ -184,14 +184,14 @@ export type GetLocations = {}; /** * @public */ -export type ValidateEntity = { - body: ValidateEntityRequest; +export type RefreshEntity = { + body: RefreshEntityRequest; }; /** * @public */ -export type RefreshEntity = { - body: RefreshEntityRequest; +export type ValidateEntity = { + body: ValidateEntityRequest; }; /** @@ -598,31 +598,6 @@ export class DefaultApiClient { }); } - /** - * Validate that a passed in entity has no errors in schema. - * @param validateEntityRequest - - */ - public async validateEntity( - // @ts-ignore - request: ValidateEntity, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/validate-entity`; - - const uri = parser.parse(uriTemplate).expand({}); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'POST', - body: JSON.stringify(request.body), - }); - } - /** * Refresh the entity related to entityRef. * @param refreshEntityRequest - @@ -647,4 +622,29 @@ export class DefaultApiClient { body: JSON.stringify(request.body), }); } + + /** + * Validate that a passed in entity has no errors in schema. + * @param validateEntityRequest - + */ + public async validateEntity( + // @ts-ignore + request: ValidateEntity, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/validate-entity`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } } diff --git a/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts b/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts deleted file mode 100644 index 11fa561e19..0000000000 --- a/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts +++ /dev/null @@ -1,653 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { DiscoveryApi } from '../types/discovery'; -import { FetchApi } from '../types/fetch'; -import crossFetch from 'cross-fetch'; -import { pluginId } from '../pluginId'; -import * as parser from 'uri-template'; - -import { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model'; -import { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model'; -import { CreateLocation201Response } from '../models/CreateLocation201Response.model'; -import { CreateLocationRequest } from '../models/CreateLocationRequest.model'; -import { EntitiesBatchResponse } from '../models/EntitiesBatchResponse.model'; -import { EntitiesQueryResponse } from '../models/EntitiesQueryResponse.model'; -import { Entity } from '../models/Entity.model'; -import { EntityAncestryResponse } from '../models/EntityAncestryResponse.model'; -import { EntityFacetsResponse } from '../models/EntityFacetsResponse.model'; -import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model'; -import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; -import { Location } from '../models/Location.model'; -import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; -import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; - -/** - * Wraps the Response type to convey a type on the json call. - * - * @public - */ -export type TypedResponse = Omit & { - json: () => Promise; -}; - -/** - * Options you can pass into a request for additional information. - * - * @public - */ -export interface RequestOptions { - token?: string; -} - -/** - * @public - */ -export type AnalyzeLocation = { - body: AnalyzeLocationRequest; -}; -/** - * @public - */ -export type CreateLocation = { - body: CreateLocationRequest; - query: { - dryRun?: string; - }; -}; -/** - * @public - */ -export type DeleteEntityByUid = { - path: { - uid: string; - }; -}; -/** - * @public - */ -export type DeleteLocation = { - path: { - id: string; - }; -}; -/** - * @public - */ -export type GetEntities = { - query: { - fields?: Array; - limit?: number; - filter?: Array; - offset?: number; - after?: string; - order?: Array; - }; -}; -/** - * @public - */ -export type GetEntitiesByQuery = { - query: { - fields?: Array; - limit?: number; - offset?: number; - orderField?: Array; - cursor?: string; - filter?: Array; - fullTextFilterTerm?: string; - fullTextFilterFields?: Array; - }; -}; -/** - * @public - */ -export type GetEntitiesByRefs = { - body: GetEntitiesByRefsRequest; - query: { - filter?: Array; - }; -}; -/** - * @public - */ -export type GetEntityAncestryByName = { - path: { - kind: string; - namespace: string; - name: string; - }; -}; -/** - * @public - */ -export type GetEntityByName = { - path: { - kind: string; - namespace: string; - name: string; - }; -}; -/** - * @public - */ -export type GetEntityByUid = { - path: { - uid: string; - }; -}; -/** - * @public - */ -export type GetEntityFacets = { - query: { - facet: Array; - filter?: Array; - }; -}; -/** - * @public - */ -export type GetLocation = { - path: { - id: string; - }; -}; -/** - * @public - */ -export type GetLocationByEntity = { - path: { - kind: string; - namespace: string; - name: string; - }; -}; -/** - * @public - */ -export type GetLocations = {}; -/** - * @public - */ -export type RefreshEntity = { - body: RefreshEntityRequest; -}; -/** - * @public - */ -export type ValidateEntity = { - body: ValidateEntityRequest; -}; - -/** - * no description - * @public - */ -export class DefaultApiClient { - private readonly discoveryApi: DiscoveryApi; - private readonly fetchApi: FetchApi; - - constructor(options: { - discoveryApi: { getBaseUrl(pluginId: string): Promise }; - fetchApi?: { fetch: typeof fetch }; - }) { - this.discoveryApi = options.discoveryApi; - this.fetchApi = options.fetchApi || { fetch: crossFetch }; - } - - /** - * Validate a given location. - * @param analyzeLocationRequest - - */ - public async analyzeLocation( - // @ts-ignore - request: AnalyzeLocation, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/analyze-location`; - - const uri = parser.parse(uriTemplate).expand({}); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'POST', - body: JSON.stringify(request.body), - }); - } - - /** - * Create a location for a given target. - * @param createLocationRequest - - * @param dryRun - - */ - public async createLocation( - // @ts-ignore - request: CreateLocation, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/locations{?dryRun}`; - - const uri = parser.parse(uriTemplate).expand({ - ...request.query, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'POST', - body: JSON.stringify(request.body), - }); - } - - /** - * Delete a single entity by UID. - * @param uid - - */ - public async deleteEntityByUid( - // @ts-ignore - request: DeleteEntityByUid, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/entities/by-uid/{uid}`; - - const uri = parser.parse(uriTemplate).expand({ - uid: request.path.uid, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'DELETE', - }); - } - - /** - * Delete a location by id. - * @param id - - */ - public async deleteLocation( - // @ts-ignore - request: DeleteLocation, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/locations/{id}`; - - const uri = parser.parse(uriTemplate).expand({ - id: request.path.id, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'DELETE', - }); - } - - /** - * Get all entities matching a given filter. - * @param fields - Restrict to just these fields in the response. - * @param limit - Number of records to return in the response. - * @param filter - Filter for just the entities defined by this filter. - * @param offset - Number of records to skip in the query page. - * @param after - Pointer to the previous page of results. - * @param order - - */ - public async getEntities( - // @ts-ignore - request: GetEntities, - options?: RequestOptions, - ): Promise>> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/entities{?fields,limit,filter*,offset,after,order*}`; - - const uri = parser.parse(uriTemplate).expand({ - ...request.query, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Search for entities by a given query. - * @param fields - Restrict to just these fields in the response. - * @param limit - Number of records to return in the response. - * @param offset - Number of records to skip in the query page. - * @param orderField - The fields to sort returned results by. - * @param cursor - Cursor to a set page of results. - * @param filter - Filter for just the entities defined by this filter. - * @param fullTextFilterTerm - Text search term. - * @param fullTextFilterFields - A comma separated list of fields to sort returned results by. - */ - public async getEntitiesByQuery( - // @ts-ignore - request: GetEntitiesByQuery, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/entities/by-query{?fields,limit,offset,orderField*,cursor,filter*,fullTextFilterTerm,fullTextFilterFields}`; - - const uri = parser.parse(uriTemplate).expand({ - ...request.query, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Get a batch set of entities given an array of entityRefs. - * @param filter - Filter for just the entities defined by this filter. - * @param getEntitiesByRefsRequest - - */ - public async getEntitiesByRefs( - // @ts-ignore - request: GetEntitiesByRefs, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/entities/by-refs{?filter*}`; - - const uri = parser.parse(uriTemplate).expand({ - ...request.query, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'POST', - body: JSON.stringify(request.body), - }); - } - - /** - * Get an entity's ancestry by entity ref. - * @param kind - - * @param namespace - - * @param name - - */ - public async getEntityAncestryByName( - // @ts-ignore - request: GetEntityAncestryByName, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}/ancestry`; - - const uri = parser.parse(uriTemplate).expand({ - kind: request.path.kind, - namespace: request.path.namespace, - name: request.path.name, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Get an entity by an entity ref. - * @param kind - - * @param namespace - - * @param name - - */ - public async getEntityByName( - // @ts-ignore - request: GetEntityByName, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}`; - - const uri = parser.parse(uriTemplate).expand({ - kind: request.path.kind, - namespace: request.path.namespace, - name: request.path.name, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Get a single entity by the UID. - * @param uid - - */ - public async getEntityByUid( - // @ts-ignore - request: GetEntityByUid, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/entities/by-uid/{uid}`; - - const uri = parser.parse(uriTemplate).expand({ - uid: request.path.uid, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Get all entity facets that match the given filters. - * @param facet - - * @param filter - Filter for just the entities defined by this filter. - */ - public async getEntityFacets( - // @ts-ignore - request: GetEntityFacets, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/entity-facets{?facet*,filter*}`; - - const uri = parser.parse(uriTemplate).expand({ - ...request.query, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Get a location by id. - * @param id - - */ - public async getLocation( - // @ts-ignore - request: GetLocation, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/locations/{id}`; - - const uri = parser.parse(uriTemplate).expand({ - id: request.path.id, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Get a location for entity. - * @param kind - - * @param namespace - - * @param name - - */ - public async getLocationByEntity( - // @ts-ignore - request: GetLocationByEntity, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/locations/by-entity/{kind}/{namespace}/{name}`; - - const uri = parser.parse(uriTemplate).expand({ - kind: request.path.kind, - namespace: request.path.namespace, - name: request.path.name, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Get all locations - */ - public async getLocations( - // @ts-ignore - request: GetLocations, - options?: RequestOptions, - ): Promise>> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/locations`; - - const uri = parser.parse(uriTemplate).expand({}); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - - /** - * Refresh the entity related to entityRef. - * @param refreshEntityRequest - - */ - public async refreshEntity( - // @ts-ignore - request: RefreshEntity, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/refresh`; - - const uri = parser.parse(uriTemplate).expand({}); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'POST', - body: JSON.stringify(request.body), - }); - } - - /** - * Validate that a passed in entity has no errors in schema. - * @param validateEntityRequest - - */ - public async validateEntity( - // @ts-ignore - request: ValidateEntity, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/validate-entity`; - - const uri = parser.parse(uriTemplate).expand({}); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'POST', - body: JSON.stringify(request.body), - }); - } -} diff --git a/packages/catalog-client/src/schema/openapi/generated/apis/index.ts b/packages/catalog-client/src/schema/openapi/generated/apis/index.ts index 51dcca33fe..af52f9db46 100644 --- a/packages/catalog-client/src/schema/openapi/generated/apis/index.ts +++ b/packages/catalog-client/src/schema/openapi/generated/apis/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './DefaultApi.client'; +export * from './Api.client'; diff --git a/plugins/catalog-backend/src/schema/openapi/generated/apis/Api.server.ts b/plugins/catalog-backend/src/schema/openapi/generated/apis/Api.server.ts index d9c016a421..abd73e2876 100644 --- a/plugins/catalog-backend/src/schema/openapi/generated/apis/Api.server.ts +++ b/plugins/catalog-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -31,6 +31,7 @@ import { EntityFacetsResponse } from '../models/EntityFacetsResponse.model'; import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model'; import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; import { Location } from '../models/Location.model'; +import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; import { ValidateEntity400Response } from '../models/ValidateEntity400Response.model'; import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; @@ -176,15 +177,6 @@ export type GetLocationByEntity = { export type GetLocations = { response: Array | Error; }; -/** - * @public - */ -export type ValidateEntity = { - body: ValidateEntityRequest; - response: void | ValidateEntity400Response; -}; -import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; - /** * @public */ @@ -192,6 +184,13 @@ export type RefreshEntity = { body: RefreshEntityRequest; response: void | Error | Error; }; +/** + * @public + */ +export type ValidateEntity = { + body: ValidateEntityRequest; + response: void | ValidateEntity400Response; +}; export type EndpointMap = { '#post|/analyze-location': AnalyzeLocation; @@ -222,7 +221,7 @@ export type EndpointMap = { '#get|/locations': GetLocations; - '#post|/validate-entity': ValidateEntity; - '#post|/refresh': RefreshEntity; + + '#post|/validate-entity': ValidateEntity; }; diff --git a/plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts b/plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts deleted file mode 100644 index 8789eee1f6..0000000000 --- a/plugins/catalog-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model'; -import { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model'; -import { CreateLocation201Response } from '../models/CreateLocation201Response.model'; -import { CreateLocationRequest } from '../models/CreateLocationRequest.model'; -import { EntitiesBatchResponse } from '../models/EntitiesBatchResponse.model'; -import { EntitiesQueryResponse } from '../models/EntitiesQueryResponse.model'; -import { Entity } from '../models/Entity.model'; -import { EntityAncestryResponse } from '../models/EntityAncestryResponse.model'; -import { EntityFacetsResponse } from '../models/EntityFacetsResponse.model'; -import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model'; -import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; -import { Location } from '../models/Location.model'; -import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; -import { ValidateEntity400Response } from '../models/ValidateEntity400Response.model'; -import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; - -/** - * @public - */ -export type AnalyzeLocation = { - body: AnalyzeLocationRequest; - response: AnalyzeLocationResponse | Error | Error; -}; -/** - * @public - */ -export type CreateLocation = { - body: CreateLocationRequest; - query: { - dryRun?: string; - }; - response: CreateLocation201Response | Error | Error; -}; -/** - * @public - */ -export type DeleteEntityByUid = { - path: { - uid: string; - }; - response: void | Error | Error; -}; -/** - * @public - */ -export type DeleteLocation = { - path: { - id: string; - }; - response: void | Error | Error; -}; -/** - * @public - */ -export type GetEntities = { - query: { - fields?: Array; - limit?: number; - filter?: Array; - offset?: number; - after?: string; - order?: Array; - }; - response: Array | Error | Error; -}; -/** - * @public - */ -export type GetEntitiesByQuery = { - query: { - fields?: Array; - limit?: number; - offset?: number; - orderField?: Array; - cursor?: string; - filter?: Array; - fullTextFilterTerm?: string; - fullTextFilterFields?: Array; - }; - response: EntitiesQueryResponse | Error | Error; -}; -/** - * @public - */ -export type GetEntitiesByRefs = { - body: GetEntitiesByRefsRequest; - query: { - filter?: Array; - }; - response: EntitiesBatchResponse | Error | Error; -}; -/** - * @public - */ -export type GetEntityAncestryByName = { - path: { - kind: string; - namespace: string; - name: string; - }; - response: EntityAncestryResponse | Error | Error; -}; -/** - * @public - */ -export type GetEntityByName = { - path: { - kind: string; - namespace: string; - name: string; - }; - response: Entity | Error | Error; -}; -/** - * @public - */ -export type GetEntityByUid = { - path: { - uid: string; - }; - response: Entity | Error | Error; -}; -/** - * @public - */ -export type GetEntityFacets = { - query: { - facet: Array; - filter?: Array; - }; - response: EntityFacetsResponse | Error | Error; -}; -/** - * @public - */ -export type GetLocation = { - path: { - id: string; - }; - response: Location | Error; -}; -/** - * @public - */ -export type GetLocationByEntity = { - path: { - kind: string; - namespace: string; - name: string; - }; - response: Location | Error; -}; -/** - * @public - */ -export type GetLocations = { - response: Array | Error; -}; -/** - * @public - */ -export type RefreshEntity = { - body: RefreshEntityRequest; - response: void | Error | Error; -}; -/** - * @public - */ -export type ValidateEntity = { - body: ValidateEntityRequest; - response: void | ValidateEntity400Response; -}; - -/** - * no description - */ - -export type EndpointMap = { - '#post|/analyze-location': AnalyzeLocation; - - '#post|/locations': CreateLocation; - - '#_delete|/entities/by-uid/{uid}': DeleteEntityByUid; - - '#_delete|/locations/{id}': DeleteLocation; - - '#get|/entities': GetEntities; - - '#get|/entities/by-query': GetEntitiesByQuery; - - '#post|/entities/by-refs': GetEntitiesByRefs; - - '#get|/entities/by-name/{kind}/{namespace}/{name}/ancestry': GetEntityAncestryByName; - - '#get|/entities/by-name/{kind}/{namespace}/{name}': GetEntityByName; - - '#get|/entities/by-uid/{uid}': GetEntityByUid; - - '#get|/entity-facets': GetEntityFacets; - - '#get|/locations/{id}': GetLocation; - - '#get|/locations/by-entity/{kind}/{namespace}/{name}': GetLocationByEntity; - - '#get|/locations': GetLocations; - - '#post|/refresh': RefreshEntity; - - '#post|/validate-entity': ValidateEntity; -}; diff --git a/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts b/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts index 79855a6fc8..a3cdbbebd2 100644 --- a/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts +++ b/plugins/catalog-backend/src/schema/openapi/generated/apis/index.ts @@ -14,4 +14,10 @@ * limitations under the License. */ -export * from './DefaultApi.server'; +// + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +export * from './Api.server'; diff --git a/plugins/events-backend/src/schema/openapi/generated/apis/Api.server.ts b/plugins/events-backend/src/schema/openapi/generated/apis/Api.server.ts new file mode 100644 index 0000000000..4a1efdfe67 --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -0,0 +1,59 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { GetSubscriptionEvents200Response } from '../models/GetSubscriptionEvents200Response.model'; +import { PostEventRequest } from '../models/PostEventRequest.model'; +import { PutSubscriptionRequest } from '../models/PutSubscriptionRequest.model'; + +/** + * @public + */ +export type GetSubscriptionEvents = { + path: { + subscriptionId: string; + }; + response: GetSubscriptionEvents200Response | void | Error; +}; +/** + * @public + */ +export type PostEvent = { + body: PostEventRequest; + response: void | void | Error; +}; +/** + * @public + */ +export type PutSubscription = { + path: { + subscriptionId: string; + }; + body: PutSubscriptionRequest; + response: void | Error; +}; + +export type EndpointMap = { + '#get|/bus/v1/subscriptions/{subscriptionId}/events': GetSubscriptionEvents; + + '#post|/bus/v1/events': PostEvent; + + '#put|/bus/v1/subscriptions/{subscriptionId}': PutSubscription; +}; diff --git a/plugins/events-backend/src/schema/openapi/generated/apis/index.ts b/plugins/events-backend/src/schema/openapi/generated/apis/index.ts new file mode 100644 index 0000000000..a3cdbbebd2 --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/apis/index.ts @@ -0,0 +1,23 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +export * from './Api.server'; diff --git a/plugins/events-backend/src/schema/openapi/generated/index.ts b/plugins/events-backend/src/schema/openapi/generated/index.ts new file mode 100644 index 0000000000..69c39313c6 --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './apis'; +export * from './router'; diff --git a/plugins/events-backend/src/schema/openapi/generated/models/ErrorError.model.ts b/plugins/events-backend/src/schema/openapi/generated/models/ErrorError.model.ts new file mode 100644 index 0000000000..0a51c67fef --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/ErrorError.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorError { + name: string; + message: string; +} diff --git a/plugins/events-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts b/plugins/events-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts new file mode 100644 index 0000000000..d44dcb66d9 --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorRequest { + method: string; + url: string; +} diff --git a/plugins/events-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts b/plugins/events-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts new file mode 100644 index 0000000000..91c120483d --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorResponse { + statusCode: number; +} diff --git a/plugins/events-backend/src/schema/openapi/generated/models/Event.model.ts b/plugins/events-backend/src/schema/openapi/generated/models/Event.model.ts new file mode 100644 index 0000000000..edd88b0738 --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/Event.model.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface Event { + /** + * The topic that the event is published on + */ + topic: string; + /** + * The event payload + */ + payload: any | null; +} diff --git a/plugins/events-backend/src/schema/openapi/generated/models/GetSubscriptionEvents200Response.model.ts b/plugins/events-backend/src/schema/openapi/generated/models/GetSubscriptionEvents200Response.model.ts new file mode 100644 index 0000000000..3ca3282f47 --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/GetSubscriptionEvents200Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Event } from '../models/Event.model'; + +/** + * @public + */ +export interface GetSubscriptionEvents200Response { + events: Array; +} diff --git a/plugins/events-backend/src/schema/openapi/generated/models/ModelError.model.ts b/plugins/events-backend/src/schema/openapi/generated/models/ModelError.model.ts new file mode 100644 index 0000000000..3e6af947ec --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/ModelError.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ErrorError } from '../models/ErrorError.model'; +import { ErrorRequest } from '../models/ErrorRequest.model'; +import { ErrorResponse } from '../models/ErrorResponse.model'; + +/** + * @public + */ +export interface ModelError { + error: ErrorError; + request: ErrorRequest; + response: ErrorResponse; +} diff --git a/plugins/events-backend/src/schema/openapi/generated/models/PostEventRequest.model.ts b/plugins/events-backend/src/schema/openapi/generated/models/PostEventRequest.model.ts new file mode 100644 index 0000000000..cfaf66ce4f --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/PostEventRequest.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Event } from '../models/Event.model'; + +/** + * @public + */ +export interface PostEventRequest { + event: Event; + /** + * The IDs of subscriptions that have already received this event + */ + notifiedSubscribers?: Array; +} diff --git a/plugins/events-backend/src/schema/openapi/generated/models/PutSubscriptionRequest.model.ts b/plugins/events-backend/src/schema/openapi/generated/models/PutSubscriptionRequest.model.ts new file mode 100644 index 0000000000..a1dc298789 --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/PutSubscriptionRequest.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface PutSubscriptionRequest { + /** + * The topics to subscribe to + */ + topics: Array; +} diff --git a/plugins/events-backend/src/schema/openapi/generated/models/index.ts b/plugins/events-backend/src/schema/openapi/generated/models/index.ts new file mode 100644 index 0000000000..5044f65fff --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/generated/models/index.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../models/ErrorError.model'; +export * from '../models/ErrorRequest.model'; +export * from '../models/ErrorResponse.model'; +export * from '../models/Event.model'; +export * from '../models/GetSubscriptionEvents200Response.model'; +export * from '../models/ModelError.model'; +export * from '../models/PostEventRequest.model'; +export * from '../models/PutSubscriptionRequest.model'; diff --git a/plugins/events-backend/src/schema/openapi.generated.ts b/plugins/events-backend/src/schema/openapi/generated/router.ts similarity index 95% rename from plugins/events-backend/src/schema/openapi.generated.ts rename to plugins/events-backend/src/schema/openapi/generated/router.ts index 8f8d6c6a82..3c43880170 100644 --- a/plugins/events-backend/src/schema/openapi.generated.ts +++ b/plugins/events-backend/src/schema/openapi/generated/router.ts @@ -17,7 +17,8 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** -import { createValidatedOpenApiRouter } from '@backstage/backend-openapi-utils'; +import { createValidatedOpenApiRouterFromGeneratedEndpointMap } from '@backstage/backend-openapi-utils'; +import { EndpointMap } from './'; export const spec = { openapi: '3.0.3', @@ -287,5 +288,11 @@ export const spec = { }, } as const; export const createOpenApiRouter = async ( - options?: Parameters['1'], -) => createValidatedOpenApiRouter(spec, options); + options?: Parameters< + typeof createValidatedOpenApiRouterFromGeneratedEndpointMap + >['1'], +) => + createValidatedOpenApiRouterFromGeneratedEndpointMap( + spec, + options, + ); diff --git a/plugins/events-backend/src/schema/openapi/index.ts b/plugins/events-backend/src/schema/openapi/index.ts new file mode 100644 index 0000000000..db98243cbf --- /dev/null +++ b/plugins/events-backend/src/schema/openapi/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './generated'; diff --git a/plugins/events-node/src/schema/openapi/generated/apis/Api.client.ts b/plugins/events-node/src/schema/openapi/generated/apis/Api.client.ts new file mode 100644 index 0000000000..c77ddc1d67 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/apis/Api.client.ts @@ -0,0 +1,163 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DiscoveryApi } from '../types/discovery'; +import { FetchApi } from '../types/fetch'; +import crossFetch from 'cross-fetch'; +import { pluginId } from '../pluginId'; +import * as parser from 'uri-template'; +import { GetSubscriptionEvents200Response } from '../models/GetSubscriptionEvents200Response.model'; +import { PostEventRequest } from '../models/PostEventRequest.model'; +import { PutSubscriptionRequest } from '../models/PutSubscriptionRequest.model'; + +/** + * Wraps the Response type to convey a type on the json call. + * + * @public + */ +export type TypedResponse = Omit & { + json: () => Promise; +}; + +/** + * Options you can pass into a request for additional information. + * + * @public + */ +export interface RequestOptions { + token?: string; +} +/** + * @public + */ +export type GetSubscriptionEvents = { + path: { + subscriptionId: string; + }; +}; +/** + * @public + */ +export type PostEvent = { + body: PostEventRequest; +}; +/** + * @public + */ +export type PutSubscription = { + path: { + subscriptionId: string; + }; + body: PutSubscriptionRequest; +}; + +/** + * @public + */ +export class DefaultApiClient { + private readonly discoveryApi: DiscoveryApi; + private readonly fetchApi: FetchApi; + + constructor(options: { + discoveryApi: { getBaseUrl(pluginId: string): Promise }; + fetchApi?: { fetch: typeof fetch }; + }) { + this.discoveryApi = options.discoveryApi; + this.fetchApi = options.fetchApi || { fetch: crossFetch }; + } + + /** + * Get new events for the provided subscription + * @param subscriptionId - + */ + public async getSubscriptionEvents( + // @ts-ignore + request: GetSubscriptionEvents, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/bus/v1/subscriptions/{subscriptionId}/events`; + + const uri = parser.parse(uriTemplate).expand({ + subscriptionId: request.path.subscriptionId, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Publish a new event + * @param postEventRequest - + */ + public async postEvent( + // @ts-ignore + request: PostEvent, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/bus/v1/events`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Ensures that the subscription exists with the provided configuration + * @param subscriptionId - + * @param putSubscriptionRequest - + */ + public async putSubscription( + // @ts-ignore + request: PutSubscription, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/bus/v1/subscriptions/{subscriptionId}`; + + const uri = parser.parse(uriTemplate).expand({ + subscriptionId: request.path.subscriptionId, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'PUT', + body: JSON.stringify(request.body), + }); + } +} diff --git a/plugins/events-node/src/schema/openapi/generated/apis/index.ts b/plugins/events-node/src/schema/openapi/generated/apis/index.ts new file mode 100644 index 0000000000..af52f9db46 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/apis/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './Api.client'; diff --git a/plugins/events-node/src/schema/openapi/generated/index.ts b/plugins/events-node/src/schema/openapi/generated/index.ts new file mode 100644 index 0000000000..bb399e97a0 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './apis'; +export * from './models'; diff --git a/plugins/events-node/src/schema/openapi/generated/models/ErrorError.model.ts b/plugins/events-node/src/schema/openapi/generated/models/ErrorError.model.ts new file mode 100644 index 0000000000..0a51c67fef --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/ErrorError.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorError { + name: string; + message: string; +} diff --git a/plugins/events-node/src/schema/openapi/generated/models/ErrorRequest.model.ts b/plugins/events-node/src/schema/openapi/generated/models/ErrorRequest.model.ts new file mode 100644 index 0000000000..d44dcb66d9 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/ErrorRequest.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorRequest { + method: string; + url: string; +} diff --git a/plugins/events-node/src/schema/openapi/generated/models/ErrorResponse.model.ts b/plugins/events-node/src/schema/openapi/generated/models/ErrorResponse.model.ts new file mode 100644 index 0000000000..91c120483d --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/ErrorResponse.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorResponse { + statusCode: number; +} diff --git a/plugins/events-node/src/schema/openapi/generated/models/Event.model.ts b/plugins/events-node/src/schema/openapi/generated/models/Event.model.ts new file mode 100644 index 0000000000..edd88b0738 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/Event.model.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface Event { + /** + * The topic that the event is published on + */ + topic: string; + /** + * The event payload + */ + payload: any | null; +} diff --git a/plugins/events-node/src/schema/openapi/generated/models/GetSubscriptionEvents200Response.model.ts b/plugins/events-node/src/schema/openapi/generated/models/GetSubscriptionEvents200Response.model.ts new file mode 100644 index 0000000000..3ca3282f47 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/GetSubscriptionEvents200Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Event } from '../models/Event.model'; + +/** + * @public + */ +export interface GetSubscriptionEvents200Response { + events: Array; +} diff --git a/plugins/events-node/src/schema/openapi/generated/models/ModelError.model.ts b/plugins/events-node/src/schema/openapi/generated/models/ModelError.model.ts new file mode 100644 index 0000000000..3e6af947ec --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/ModelError.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ErrorError } from '../models/ErrorError.model'; +import { ErrorRequest } from '../models/ErrorRequest.model'; +import { ErrorResponse } from '../models/ErrorResponse.model'; + +/** + * @public + */ +export interface ModelError { + error: ErrorError; + request: ErrorRequest; + response: ErrorResponse; +} diff --git a/plugins/events-node/src/schema/openapi/generated/models/PostEventRequest.model.ts b/plugins/events-node/src/schema/openapi/generated/models/PostEventRequest.model.ts new file mode 100644 index 0000000000..cfaf66ce4f --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/PostEventRequest.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Event } from '../models/Event.model'; + +/** + * @public + */ +export interface PostEventRequest { + event: Event; + /** + * The IDs of subscriptions that have already received this event + */ + notifiedSubscribers?: Array; +} diff --git a/plugins/events-node/src/schema/openapi/generated/models/PutSubscriptionRequest.model.ts b/plugins/events-node/src/schema/openapi/generated/models/PutSubscriptionRequest.model.ts new file mode 100644 index 0000000000..a1dc298789 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/PutSubscriptionRequest.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface PutSubscriptionRequest { + /** + * The topics to subscribe to + */ + topics: Array; +} diff --git a/plugins/events-node/src/schema/openapi/generated/models/index.ts b/plugins/events-node/src/schema/openapi/generated/models/index.ts new file mode 100644 index 0000000000..5044f65fff --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/models/index.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../models/ErrorError.model'; +export * from '../models/ErrorRequest.model'; +export * from '../models/ErrorResponse.model'; +export * from '../models/Event.model'; +export * from '../models/GetSubscriptionEvents200Response.model'; +export * from '../models/ModelError.model'; +export * from '../models/PostEventRequest.model'; +export * from '../models/PutSubscriptionRequest.model'; diff --git a/plugins/events-node/src/schema/openapi/generated/pluginId.ts b/plugins/events-node/src/schema/openapi/generated/pluginId.ts new file mode 100644 index 0000000000..36b5433cc3 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/pluginId.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const pluginId = 'events'; diff --git a/plugins/events-node/src/schema/openapi/generated/types/discovery.ts b/plugins/events-node/src/schema/openapi/generated/types/discovery.ts new file mode 100644 index 0000000000..a7f87d3780 --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/types/discovery.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This is a copy of the DiscoveryApi, to avoid importing core-plugin-api. + */ +export type DiscoveryApi = { + getBaseUrl(pluginId: string): Promise; +}; diff --git a/plugins/events-node/src/schema/openapi/generated/types/fetch.ts b/plugins/events-node/src/schema/openapi/generated/types/fetch.ts new file mode 100644 index 0000000000..3de56c028e --- /dev/null +++ b/plugins/events-node/src/schema/openapi/generated/types/fetch.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This is a copy of FetchApi, to avoid importing core-plugin-api. + */ +export type FetchApi = { + fetch: typeof fetch; +}; diff --git a/plugins/events-node/src/schema/openapi/index.ts b/plugins/events-node/src/schema/openapi/index.ts new file mode 100644 index 0000000000..db98243cbf --- /dev/null +++ b/plugins/events-node/src/schema/openapi/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './generated'; diff --git a/plugins/search-backend/src/schema/openapi.yaml b/plugins/search-backend/src/schema/openapi.yaml index cbf3db273a..b1b8e83f58 100644 --- a/plugins/search-backend/src/schema/openapi.yaml +++ b/plugins/search-backend/src/schema/openapi.yaml @@ -175,4 +175,4 @@ paths: allowReserved: true schema: type: object - additionalProperties: true + additionalProperties: {} diff --git a/plugins/search-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts b/plugins/search-backend/src/schema/openapi/generated/apis/Api.server.ts similarity index 96% rename from plugins/search-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts rename to plugins/search-backend/src/schema/openapi/generated/apis/Api.server.ts index 5d228b9f84..d23648d8b5 100644 --- a/plugins/search-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts +++ b/plugins/search-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +// + // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** @@ -29,14 +31,11 @@ export type Query = { types?: Array; pageCursor?: string; pageLimit?: number; + unknown?: { [key: string]: any }; }; response: Query200Response | Error; }; -/** - * no description - */ - export type EndpointMap = { '#get|/query': Query; }; diff --git a/plugins/search-backend/src/schema/openapi/generated/apis/index.ts b/plugins/search-backend/src/schema/openapi/generated/apis/index.ts index 79855a6fc8..a3cdbbebd2 100644 --- a/plugins/search-backend/src/schema/openapi/generated/apis/index.ts +++ b/plugins/search-backend/src/schema/openapi/generated/apis/index.ts @@ -14,4 +14,10 @@ * limitations under the License. */ -export * from './DefaultApi.server'; +// + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +export * from './Api.server'; diff --git a/plugins/search-backend/src/schema/openapi/generated/router.ts b/plugins/search-backend/src/schema/openapi/generated/router.ts index 8d55dfeef2..a7dd980142 100644 --- a/plugins/search-backend/src/schema/openapi/generated/router.ts +++ b/plugins/search-backend/src/schema/openapi/generated/router.ts @@ -253,7 +253,7 @@ export const spec = { allowReserved: true, schema: { type: 'object', - additionalProperties: true, + additionalProperties: {}, }, }, ], From 384e494ce1693e945eff68952f6a237298421fc0 Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Thu, 28 Nov 2024 16:21:17 -0500 Subject: [PATCH 6/7] add changeset Signed-off-by: aramissennyeydd --- .changeset/new-rules-teach.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changeset/new-rules-teach.md diff --git a/.changeset/new-rules-teach.md b/.changeset/new-rules-teach.md new file mode 100644 index 0000000000..cae0215bfc --- /dev/null +++ b/.changeset/new-rules-teach.md @@ -0,0 +1,8 @@ +--- +'@backstage/catalog-client': minor +'@backstage/plugin-catalog-backend': minor +'@backstage/plugin-events-backend': minor +'@backstage/plugin-search-backend': minor +--- + +Internal updates to generated code. From 4de5950e24c1c988e8b411586d82a7a10f9bdaa2 Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Thu, 28 Nov 2024 17:22:52 -0500 Subject: [PATCH 7/7] fix build Signed-off-by: aramissennyeydd --- plugins/events-backend/src/service/hub/createEventBusRouter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/events-backend/src/service/hub/createEventBusRouter.ts b/plugins/events-backend/src/service/hub/createEventBusRouter.ts index 1ac95be4b6..e8dc8ef113 100644 --- a/plugins/events-backend/src/service/hub/createEventBusRouter.ts +++ b/plugins/events-backend/src/service/hub/createEventBusRouter.ts @@ -22,7 +22,7 @@ import { SchedulerService, } from '@backstage/backend-plugin-api'; import { Handler } from 'express'; -import { createOpenApiRouter } from '../../schema/openapi.generated'; +import { createOpenApiRouter } from '../../schema/openapi'; import { MemoryEventBusStore } from './MemoryEventBusStore'; import { DatabaseEventBusStore } from './DatabaseEventBusStore'; import { EventBusStore } from './types';