update based on PR feedback
Signed-off-by: Aramis Sennyey <aramiss@spotify.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend-module-openapi-spec': minor
|
||||
'@backstage/plugin-catalog-backend-module-backstage-openapi': minor
|
||||
---
|
||||
|
||||
Adds a new catalog module for ingesting Backstage plugin OpenAPI specs into the catalog for display as an API entity.
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ yarn.lock @backstage/maintainers @backst
|
||||
/plugins/catalog-* @backstage/maintainers @backstage/reviewers @backstage/catalog-maintainers
|
||||
/plugins/catalog-backend-module-aws @backstage/maintainers @backstage/reviewers @backstage/catalog-maintainers @pjungermann
|
||||
/plugins/catalog-backend-module-bitbucket-cloud @backstage/maintainers @backstage/reviewers @backstage/catalog-maintainers @pjungermann
|
||||
/plugins/catalog-backend-module-openapi-spec @backstage/maintainers @backstage/reviewers @backstage/openapi-tooling-maintainers
|
||||
/plugins/catalog-backend-module-backstage-openapi @backstage/maintainers @backstage/reviewers @backstage/openapi-tooling-maintainers
|
||||
/plugins/catalog-backend-module-msgraph @backstage/maintainers @backstage/reviewers @backstage/catalog-maintainers @pjungermann
|
||||
/plugins/catalog-backend-module-puppetdb @backstage/maintainers @backstage/reviewers @backstage/catalog-maintainers
|
||||
/plugins/catalog-graph @backstage/maintainers @backstage/reviewers @backstage/catalog-maintainers @backstage/sda-se-reviewers
|
||||
|
||||
+6
-6
@@ -235,6 +235,12 @@ catalog:
|
||||
- System
|
||||
- Domain
|
||||
- Location
|
||||
providers:
|
||||
openapi:
|
||||
plugins:
|
||||
- catalog
|
||||
- search
|
||||
- todo
|
||||
|
||||
processors:
|
||||
ldapOrg:
|
||||
@@ -464,9 +470,3 @@ stackstorm:
|
||||
|
||||
permission:
|
||||
enabled: true
|
||||
|
||||
openapi:
|
||||
plugins:
|
||||
- catalog
|
||||
- search
|
||||
- todo
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
"@backstage/plugin-azure-devops-backend": "workspace:^",
|
||||
"@backstage/plugin-badges-backend": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend-module-backstage-openapi": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend-module-openapi": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend-module-openapi-spec": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend-module-unprocessed": "workspace:^",
|
||||
"@backstage/plugin-devtools-backend": "workspace:^",
|
||||
|
||||
@@ -43,7 +43,9 @@ backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
|
||||
backend.add(import('@backstage/plugin-search-backend-module-catalog/alpha'));
|
||||
backend.add(import('@backstage/plugin-search-backend-module-explore/alpha'));
|
||||
backend.add(import('@backstage/plugin-search-backend-module-techdocs/alpha'));
|
||||
backend.add(import('@backstage/plugin-catalog-backend-module-openapi-spec'));
|
||||
backend.add(
|
||||
import('@backstage/plugin-catalog-backend-module-backstage-openapi'),
|
||||
);
|
||||
backend.add(import('@backstage/plugin-search-backend/alpha'));
|
||||
backend.add(import('@backstage/plugin-techdocs-backend/alpha'));
|
||||
backend.add(import('@backstage/plugin-todo-backend'));
|
||||
|
||||
@@ -445,9 +445,6 @@ type ObjectWithContentSchema<
|
||||
? SchemaRef<Doc, Object['content']['application/json']['schema']>
|
||||
: never;
|
||||
|
||||
// @public
|
||||
export const OPENAPI_SPEC_ROUTE = '/openapi.json';
|
||||
|
||||
// @public (undocumented)
|
||||
type OptionalMap<
|
||||
T extends {
|
||||
|
||||
@@ -32,4 +32,3 @@ export type {
|
||||
} from './utility';
|
||||
export type { ApiRouter } from './router';
|
||||
export { createValidatedOpenApiRouter, getOpenApiSpecRoute } from './stub';
|
||||
export * from './constants';
|
||||
|
||||
+12
-8
@@ -1,8 +1,8 @@
|
||||
# catalog-backend-module-openapi-spec
|
||||
# catalog-backend-module-backstage-openapi
|
||||
|
||||
## Summary
|
||||
|
||||
This module installs an entity provider that exports a single entity, your Backstage instance documentation, which merges as many backend plugins as you have defined in the config value `openapi.plugins`.
|
||||
This module installs an entity provider that exports a single entity, your Backstage instance documentation, which merges as many backend plugins as you have defined in the config value `catalog.providers.openapi.plugins`.
|
||||
|
||||
## Notes
|
||||
|
||||
@@ -13,17 +13,21 @@ This module installs an entity provider that exports a single entity, your Backs
|
||||
To your new backend file, add
|
||||
|
||||
```ts title="packages/backend/src/index.ts"
|
||||
backend.add(import('@backstage/plugin-catalog-backend-module-openapi-spec'));
|
||||
backend.add(
|
||||
import('@backstage/plugin-catalog-backend-module-backstage-openapi'),
|
||||
);
|
||||
```
|
||||
|
||||
Add a list of plugins to your config like,
|
||||
|
||||
```yaml title="app-config.yaml"
|
||||
openapi:
|
||||
plugins:
|
||||
- catalog
|
||||
- todo
|
||||
- search
|
||||
catalog:
|
||||
providers:
|
||||
openapi:
|
||||
plugins:
|
||||
- catalog
|
||||
- todo
|
||||
- search
|
||||
```
|
||||
|
||||
We will attempt to load each plugin's OpenAPI spec hosted at `${pluginRoute}/openapi.json`. These are automatically added if you are using `@backstage/backend-openapi-utils`'s `createValidatedOpenApiRouter`.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## API Report File for "@backstage/plugin-catalog-backend-module-openapi-spec"
|
||||
## API Report File for "@backstage/plugin-catalog-backend-module-backstage-openapi"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: backstage-plugin-catalog-backend-module-openapi-spec
|
||||
title: '@backstage/plugin-catalog-backend-module-openapi-spec'
|
||||
name: backstage-plugin-catalog-backend-module-backstage-openapi
|
||||
title: '@backstage/plugin-catalog-backend-module-backstage-openapi'
|
||||
spec:
|
||||
lifecycle: experimental
|
||||
type: backstage-backend-plugin-module
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
{
|
||||
"name": "@backstage/plugin-catalog-backend-module-openapi-spec",
|
||||
"name": "@backstage/plugin-catalog-backend-module-backstage-openapi",
|
||||
"version": "0.0.0",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
"private": true,
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"main": "dist/index.cjs.js",
|
||||
@@ -27,6 +26,7 @@
|
||||
"@backstage/backend-openapi-utils": "workspace:^",
|
||||
"@backstage/backend-plugin-api": "workspace:^",
|
||||
"@backstage/backend-tasks": "workspace:^",
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/config": "workspace:^",
|
||||
"@backstage/errors": "workspace:^",
|
||||
"@backstage/plugin-catalog-node": "workspace:^",
|
||||
@@ -40,7 +40,6 @@
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/cli": "workspace:^",
|
||||
"@backstage/test-utils": "workspace:^",
|
||||
"@types/supertest": "^2.0.8",
|
||||
+12
-6
@@ -13,7 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { ApiEntity } from '@backstage/catalog-model';
|
||||
import {
|
||||
ANNOTATION_LOCATION,
|
||||
ANNOTATION_ORIGIN_LOCATION,
|
||||
type ApiEntity,
|
||||
} from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ForwardedError } from '@backstage/errors';
|
||||
import {
|
||||
@@ -202,7 +206,9 @@ export class InternalOpenApiDocumentationProvider implements EntityProvider {
|
||||
}
|
||||
|
||||
async refresh(logger: LoggerService) {
|
||||
const pluginsToMerge = this.config.getStringArray('openapi.plugins');
|
||||
const pluginsToMerge = this.config.getStringArray(
|
||||
'catalog.providers.openapi.plugins',
|
||||
);
|
||||
logger.info(`Loading specs from from ${pluginsToMerge}.`);
|
||||
const documentationEntity: ApiEntity = {
|
||||
apiVersion: 'backstage.io/v1beta1',
|
||||
@@ -211,10 +217,10 @@ export class InternalOpenApiDocumentationProvider implements EntityProvider {
|
||||
name: 'INTERNAL_instance_openapi_doc',
|
||||
title: 'Your Backstage Instance documentation',
|
||||
annotations: {
|
||||
'backstage.io/managed-by-location':
|
||||
'internal-package:@backstage/plugin-catalog-backend-module-openapi-spec',
|
||||
'backstage.io/managed-by-origin-location':
|
||||
'internal-package:@backstage/plugin-catalog-backend-module-openapi-spec',
|
||||
[ANNOTATION_LOCATION]:
|
||||
'internal-package:@backstage/plugin-catalog-backend-module-backstage-openapi',
|
||||
[ANNOTATION_ORIGIN_LOCATION]:
|
||||
'internal-package:@backstage/plugin-catalog-backend-module-backstage-openapi',
|
||||
},
|
||||
},
|
||||
spec: {
|
||||
@@ -5388,6 +5388,35 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/plugin-catalog-backend-module-backstage-openapi@workspace:^, @backstage/plugin-catalog-backend-module-backstage-openapi@workspace:plugins/catalog-backend-module-backstage-openapi":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/plugin-catalog-backend-module-backstage-openapi@workspace:plugins/catalog-backend-module-backstage-openapi"
|
||||
dependencies:
|
||||
"@backstage/backend-common": "workspace:^"
|
||||
"@backstage/backend-openapi-utils": "workspace:^"
|
||||
"@backstage/backend-plugin-api": "workspace:^"
|
||||
"@backstage/backend-tasks": "workspace:^"
|
||||
"@backstage/catalog-model": "workspace:^"
|
||||
"@backstage/cli": "workspace:^"
|
||||
"@backstage/config": "workspace:^"
|
||||
"@backstage/errors": "workspace:^"
|
||||
"@backstage/plugin-catalog-node": "workspace:^"
|
||||
"@backstage/test-utils": "workspace:^"
|
||||
"@types/express": "*"
|
||||
"@types/supertest": ^2.0.8
|
||||
cross-fetch: ^3.1.5
|
||||
express: ^4.17.1
|
||||
express-promise-router: ^4.1.0
|
||||
lodash: ^4.17.21
|
||||
msw: ^1.0.0
|
||||
openapi-merge: ^1.3.2
|
||||
openapi3-ts: ^3.1.2
|
||||
supertest: ^6.2.4
|
||||
uuid: ^9.0.0
|
||||
yn: ^4.0.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/plugin-catalog-backend-module-bitbucket-cloud@workspace:plugins/catalog-backend-module-bitbucket-cloud":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/plugin-catalog-backend-module-bitbucket-cloud@workspace:plugins/catalog-backend-module-bitbucket-cloud"
|
||||
@@ -5636,35 +5665,6 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/plugin-catalog-backend-module-openapi-spec@workspace:^, @backstage/plugin-catalog-backend-module-openapi-spec@workspace:plugins/catalog-backend-module-openapi-spec":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/plugin-catalog-backend-module-openapi-spec@workspace:plugins/catalog-backend-module-openapi-spec"
|
||||
dependencies:
|
||||
"@backstage/backend-common": "workspace:^"
|
||||
"@backstage/backend-openapi-utils": "workspace:^"
|
||||
"@backstage/backend-plugin-api": "workspace:^"
|
||||
"@backstage/backend-tasks": "workspace:^"
|
||||
"@backstage/catalog-model": "workspace:^"
|
||||
"@backstage/cli": "workspace:^"
|
||||
"@backstage/config": "workspace:^"
|
||||
"@backstage/errors": "workspace:^"
|
||||
"@backstage/plugin-catalog-node": "workspace:^"
|
||||
"@backstage/test-utils": "workspace:^"
|
||||
"@types/express": "*"
|
||||
"@types/supertest": ^2.0.8
|
||||
cross-fetch: ^3.1.5
|
||||
express: ^4.17.1
|
||||
express-promise-router: ^4.1.0
|
||||
lodash: ^4.17.21
|
||||
msw: ^1.0.0
|
||||
openapi-merge: ^1.3.2
|
||||
openapi3-ts: ^3.1.2
|
||||
supertest: ^6.2.4
|
||||
uuid: ^9.0.0
|
||||
yn: ^4.0.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/plugin-catalog-backend-module-openapi@workspace:^, @backstage/plugin-catalog-backend-module-openapi@workspace:plugins/catalog-backend-module-openapi":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/plugin-catalog-backend-module-openapi@workspace:plugins/catalog-backend-module-openapi"
|
||||
@@ -25687,8 +25687,8 @@ __metadata:
|
||||
"@backstage/plugin-azure-devops-backend": "workspace:^"
|
||||
"@backstage/plugin-badges-backend": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend-module-backstage-openapi": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend-module-openapi": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend-module-openapi-spec": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend-module-unprocessed": "workspace:^"
|
||||
"@backstage/plugin-devtools-backend": "workspace:^"
|
||||
|
||||
Reference in New Issue
Block a user