diff --git a/.changeset/catalog-react-configschema-migration.md b/.changeset/catalog-react-configschema-migration.md new file mode 100644 index 0000000000..766dbef24f --- /dev/null +++ b/.changeset/catalog-react-configschema-migration.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +Migrated alpha entity blueprints to use the new `configSchema` option with direct zod schema values. diff --git a/packages/frontend-plugin-api/src/schema/createPortableSchema.test.ts b/packages/frontend-plugin-api/src/schema/createPortableSchema.test.ts index 81b3ce3dc8..d612578f32 100644 --- a/packages/frontend-plugin-api/src/schema/createPortableSchema.test.ts +++ b/packages/frontend-plugin-api/src/schema/createPortableSchema.test.ts @@ -334,4 +334,20 @@ describe('createConfigSchema', () => { ); }); }); + + describe('edge cases', () => { + it('should handle an empty configSchema', () => { + const schema = createConfigSchema({}); + + expect(schema.parse({})).toEqual({}); + expect(schema.parse(undefined)).toEqual({}); + + const result = schema.schema(); + expect(result.schema).toEqual({ + type: 'object', + properties: {}, + additionalProperties: false, + }); + }); + }); }); diff --git a/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.test.tsx b/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.test.tsx index a76fafac89..e2d420bb38 100644 --- a/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.test.tsx +++ b/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.test.tsx @@ -309,6 +309,70 @@ describe('createExtensionBlueprint', () => { ); }); + it('should merge configSchema from blueprint with deprecated config.schema from override', () => { + const TestBlueprint = createExtensionBlueprint({ + kind: 'test-extension', + attachTo: { id: 'test', input: 'default' }, + output: [coreExtensionData.reactElement], + configSchema: { + title: z => z.string().default('default title'), + }, + factory(_, { config }) { + return [coreExtensionData.reactElement(