diff --git a/.changeset/afraid-numbers-invite.md b/.changeset/afraid-numbers-invite.md new file mode 100644 index 0000000000..ee81341d3a --- /dev/null +++ b/.changeset/afraid-numbers-invite.md @@ -0,0 +1,15 @@ +--- +'@backstage/repo-tools': minor +--- + +Updates the OpenAPI client template to support the new format for identifying plugin ID. You should now use `info.title` like so, + +```diff +info: ++ title: yourPluginId +- title: @internal/plugin-*-backend + +servers: + - / +- - yourPluginId +``` diff --git a/.changeset/long-suns-bow.md b/.changeset/long-suns-bow.md new file mode 100644 index 0000000000..81fafa8dae --- /dev/null +++ b/.changeset/long-suns-bow.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-catalog-backend': minor +'@backstage/plugin-search-backend': minor +'@backstage/plugin-todo-backend': patch +--- + +Updates the OpenAPI spec to use plugin as `info.title` instead of package name. diff --git a/.changeset/nine-bulldogs-camp.md b/.changeset/nine-bulldogs-camp.md new file mode 100644 index 0000000000..b6612b9948 --- /dev/null +++ b/.changeset/nine-bulldogs-camp.md @@ -0,0 +1,8 @@ +--- +'@backstage/catalog-client': minor +'@backstage/plugin-catalog-backend': minor +'@backstage/plugin-search-backend': minor +'@backstage/plugin-todo-backend': patch +--- + +Updates the OpenAPI specification title to plugin ID instead of package name. diff --git a/docs/openapi/generate-client.md b/docs/openapi/generate-client.md index 4afa7d64d7..f2c7c64574 100644 --- a/docs/openapi/generate-client.md +++ b/docs/openapi/generate-client.md @@ -8,15 +8,12 @@ description: Documentation on how to create a client for a given OpenAPI spec ### Prerequisites -1. Add your plugin ID as the last `servers` item, like this, +1. Set your OpenAPI file's `info.title` to your pluginID like so, ```yaml -servers: - # first value, used for OpenAPI router validation. - - url: / - - # final value, pluginId. - - url: catalog +info: + # your pluginId + title: catalog ``` 2. Find or create a new plugin to house your new generated client. Currently, we do not support generating an entirely new plugin and instead just generate client files. diff --git a/packages/repo-tools/templates/typescript-backstage/pluginId.mustache b/packages/repo-tools/templates/typescript-backstage/pluginId.mustache index 8bc8461cc9..a71829bb84 100644 --- a/packages/repo-tools/templates/typescript-backstage/pluginId.mustache +++ b/packages/repo-tools/templates/typescript-backstage/pluginId.mustache @@ -1,6 +1,2 @@ -{{#servers}} -{{#-last}} -export const pluginId = "{{url}}"; -{{/-last}} -{{/servers}} \ No newline at end of file +export const pluginId = "{{appName}}"; \ No newline at end of file diff --git a/plugins/catalog-backend/src/schema/openapi.generated.ts b/plugins/catalog-backend/src/schema/openapi.generated.ts index fe64c75373..c29dd78ec6 100644 --- a/plugins/catalog-backend/src/schema/openapi.generated.ts +++ b/plugins/catalog-backend/src/schema/openapi.generated.ts @@ -22,7 +22,7 @@ import { createValidatedOpenApiRouter } from '@backstage/backend-openapi-utils'; export const spec = { openapi: '3.0.3', info: { - title: '@backstage/plugin-catalog-backend', + title: 'catalog', version: '1', description: 'The Backstage backend plugin that provides the Backstage catalog', @@ -36,9 +36,6 @@ export const spec = { { url: '/', }, - { - url: 'catalog', - }, ], components: { examples: {}, diff --git a/plugins/catalog-backend/src/schema/openapi.yaml b/plugins/catalog-backend/src/schema/openapi.yaml index d3ef718286..51283d5fbc 100644 --- a/plugins/catalog-backend/src/schema/openapi.yaml +++ b/plugins/catalog-backend/src/schema/openapi.yaml @@ -1,6 +1,6 @@ openapi: 3.0.3 info: - title: '@backstage/plugin-catalog-backend' + title: catalog version: '1' description: The Backstage backend plugin that provides the Backstage catalog license: @@ -9,7 +9,6 @@ info: contact: {} servers: - url: / - - url: catalog components: examples: {} headers: {} diff --git a/plugins/search-backend/src/schema/openapi.generated.ts b/plugins/search-backend/src/schema/openapi.generated.ts index 2586b7a5bf..06b576ba70 100644 --- a/plugins/search-backend/src/schema/openapi.generated.ts +++ b/plugins/search-backend/src/schema/openapi.generated.ts @@ -22,7 +22,7 @@ import { createValidatedOpenApiRouter } from '@backstage/backend-openapi-utils'; export const spec = { openapi: '3.0.3', info: { - title: '@backstage/plugin-search-backend', + title: 'search', version: '1', description: 'The Backstage backend plugin that provides search functionality.', diff --git a/plugins/search-backend/src/schema/openapi.yaml b/plugins/search-backend/src/schema/openapi.yaml index 79bb84dfe0..47f7e0a1e5 100644 --- a/plugins/search-backend/src/schema/openapi.yaml +++ b/plugins/search-backend/src/schema/openapi.yaml @@ -1,6 +1,6 @@ openapi: 3.0.3 info: - title: '@backstage/plugin-search-backend' + title: search version: '1' description: The Backstage backend plugin that provides search functionality. license: diff --git a/plugins/todo-backend/src/schema/openapi.generated.ts b/plugins/todo-backend/src/schema/openapi.generated.ts index effe851790..238be2fe5b 100644 --- a/plugins/todo-backend/src/schema/openapi.generated.ts +++ b/plugins/todo-backend/src/schema/openapi.generated.ts @@ -22,7 +22,7 @@ import { createValidatedOpenApiRouter } from '@backstage/backend-openapi-utils'; export const spec = { openapi: '3.0.3', info: { - title: '@backstage/plugin-todo-backend', + title: 'todo', version: '1', description: 'The Backstage backend plugin that provides source code todo comment browsing.', diff --git a/plugins/todo-backend/src/schema/openapi.yaml b/plugins/todo-backend/src/schema/openapi.yaml index 8023144f48..7408927b99 100644 --- a/plugins/todo-backend/src/schema/openapi.yaml +++ b/plugins/todo-backend/src/schema/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.3 info: - title: '@backstage/plugin-todo-backend' + title: todo version: '1' description: The Backstage backend plugin that provides source code todo comment browsing. license: