Address PR review comments

- Remove unused deps @backstage/filter-predicates and zod-validation-error
  from catalog-model
- Deduplicate defaultCatalogEntityModel by re-exporting from the single
  source in model/defaultCatalogEntityModel.ts
- Fix typos: "Retuns"/"epxressed", "Obviopusly", "recorsively"
- Use domain-prefixed layer ID for scaffolder template model

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
Fredrik Adelöw
2026-04-14 13:41:22 +02:00
parent 85ed75ee93
commit 445aefd4b9
7 changed files with 6 additions and 40 deletions
+1 -3
View File
@@ -49,13 +49,11 @@
},
"dependencies": {
"@backstage/errors": "workspace:^",
"@backstage/filter-predicates": "workspace:^",
"@backstage/types": "workspace:^",
"ajv": "^8.10.0",
"ajv-errors": "^3.0.0",
"lodash": "^4.17.21",
"zod": "^3.25.76",
"zod-validation-error": "^4.0.2"
"zod": "^3.25.76"
},
"devDependencies": {
"@backstage/cli": "workspace:^",
+1 -31
View File
@@ -14,18 +14,6 @@
* limitations under the License.
*/
import { createCatalogModelLayer } from './model/createCatalogModelLayer';
import { apiEntityModel } from './kinds/ApiEntityV1alpha1';
import { componentEntityModel } from './kinds/ComponentEntityV1alpha1';
import { domainEntityModel } from './kinds/DomainEntityV1alpha1';
import { groupEntityModel } from './kinds/GroupEntityV1alpha1';
import { locationEntityModel } from './kinds/LocationEntityV1alpha1';
import { resourceEntityModel } from './kinds/ResourceEntityV1alpha1';
import { systemEntityModel } from './kinds/SystemEntityV1alpha1';
import { userEntityModel } from './kinds/UserEntityV1alpha1';
import { wellKnownAnnotationsModel } from './kinds/annotations';
import { wellKnownRelationsModel } from './kinds/relations';
export type { AlphaEntity } from './entity/AlphaEntity';
export type {
EntityStatus,
@@ -33,22 +21,4 @@ export type {
EntityStatusLevel,
} from './entity/EntityStatus';
export * from './model';
/**
* @alpha
*/
export const defaultCatalogEntityModel = createCatalogModelLayer({
layerId: 'catalog.backstage.io/default-entity-model',
builder: model => {
model.import(apiEntityModel);
model.import(componentEntityModel);
model.import(domainEntityModel);
model.import(groupEntityModel);
model.import(locationEntityModel);
model.import(resourceEntityModel);
model.import(systemEntityModel);
model.import(userEntityModel);
model.import(wellKnownRelationsModel);
model.import(wellKnownAnnotationsModel);
},
});
export { defaultCatalogEntityModel } from './model/defaultCatalogEntityModel';
@@ -24,7 +24,7 @@ export function isJsonObject(value?: unknown): value is JsonObject {
}
/**
* Asserts that the value is a JSON object recorsively containing only JSON safe
* Asserts that the value is a JSON object recursively containing only JSON safe
* values and no circular references.
*/
export function isJsonObjectDeep(value: unknown): value is JsonObject {
@@ -59,7 +59,7 @@ export type AsyncCatalogModelSourceGenerator = AsyncGenerator<
*/
export interface CatalogModelSource {
/**
* Retuns a stream of layers as epxressed by this particular source.
* Returns a stream of layers as expressed by this particular source.
*/
read(
options?: CatalogModelSourceReadOptions,
@@ -53,7 +53,7 @@ export class ModelHolder {
);
}, 3000);
// TODO(freben): Obviopusly this needs to be extended to support dynamic
// TODO(freben): Obviously this needs to be extended to support dynamic
// model source events during the lifetime of the plugin.
try {
const layers = await Promise.all(
@@ -23,7 +23,7 @@ import schema from './Template.v1beta3.schema.json';
* @alpha
*/
export const templateModelLayer = createCatalogModelLayer({
layerId: 'Template',
layerId: 'scaffolder.backstage.io/kind-template',
builder: model => {
model.addKind({
group: 'scaffolder.backstage.io',
-2
View File
@@ -2814,7 +2814,6 @@ __metadata:
dependencies:
"@backstage/cli": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/filter-predicates": "workspace:^"
"@backstage/types": "workspace:^"
"@types/json-schema": "npm:^7.0.5"
"@types/lodash": "npm:^4.14.151"
@@ -2823,7 +2822,6 @@ __metadata:
lodash: "npm:^4.17.21"
yaml: "npm:^2.0.0"
zod: "npm:^3.25.76"
zod-validation-error: "npm:^4.0.2"
languageName: unknown
linkType: soft