Merge pull request #33663 from backstage/freben/catalog-model-extensions

Add catalog model layer system with JSON Schema based kind declarations
This commit is contained in:
Fredrik Adelöw
2026-04-14 16:29:01 +02:00
committed by GitHub
131 changed files with 10896 additions and 44 deletions
@@ -4,6 +4,7 @@
```ts
import { BasicPermission } from '@backstage/plugin-permission-common';
import { CatalogModelLayer } from '@backstage/catalog-model/alpha';
import { ResourcePermission } from '@backstage/plugin-permission-common';
// @alpha
@@ -21,6 +22,9 @@ export const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = 'scaffolder-template';
// @alpha
export const scaffolderActionPermissions: ResourcePermission<'scaffolder-action'>[];
// @alpha
export const scaffolderCatalogModelLayer: CatalogModelLayer;
// @alpha
export const scaffolderPermissions: (
| BasicPermission
+1
View File
@@ -15,3 +15,4 @@
*/
export * from './permissions';
export { scaffolderCatalogModelLayer } from './catalogModel';
@@ -0,0 +1,57 @@
/*
* Copyright 2026 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.
*/
import { createCatalogModelLayer } from '@backstage/catalog-model/alpha';
import type { JsonObject } from '@backstage/types';
import jsonSchema from './Template.v1beta3.schema.json';
/**
* Extends the catalog model with the Template kind.
*
* @alpha
*/
export const scaffolderCatalogModelLayer = createCatalogModelLayer({
layerId: 'scaffolder.backstage.io/kind-template',
builder: model => {
model.addKind({
group: 'scaffolder.backstage.io',
names: {
kind: 'Template',
singular: 'template',
plural: 'templates',
},
description: 'A template for scaffolding a new component',
versions: [
{
name: 'v1beta3',
relationFields: [
{
selector: { path: 'spec.owner' },
relation: 'ownedBy',
defaultKind: 'Group',
// TODO: This was inherit since before, but should ownership in general be default instead?
defaultNamespace: 'inherit',
allowedKinds: ['Group', 'User'],
},
],
schema: {
jsonSchema: jsonSchema as JsonObject,
},
},
],
});
},
});