Merge pull request #22352 from sennyeya/openapi-tooling/plugin-id

feat(openapi-tooling): Update template to use `info.title` as plugin ID
This commit is contained in:
Patrik Oldsberg
2024-01-21 18:43:20 +01:00
committed by GitHub
11 changed files with 41 additions and 22 deletions
+15
View File
@@ -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
```
+7
View File
@@ -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.
+8
View File
@@ -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.
+4 -7
View File
@@ -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.
@@ -1,6 +1,2 @@
{{#servers}}
{{#-last}}
export const pluginId = "{{url}}";
{{/-last}}
{{/servers}}
export const pluginId = "{{appName}}";
@@ -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: {},
@@ -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: {}
@@ -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.',
@@ -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:
@@ -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.',
+1 -1
View File
@@ -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: