From 1df5fc9547985c0d3b8256e14e9d21ff348cc932 Mon Sep 17 00:00:00 2001 From: Rickard Dybeck Date: Tue, 13 Jun 2023 17:04:46 -0400 Subject: [PATCH] Remove requirement that deprecated property 'target' is provided The target property has been deprecated for a long time on an EntityRelation, but is still required in the spec. This fix removes that requirement, but keeps it around for now. Signed-off-by: Rickard Dybeck --- .changeset/rich-owls-smell.md | 5 +++++ packages/catalog-model/src/schema/shared/common.schema.json | 2 +- .../src/validation/entitySchemaValidator.test.ts | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 .changeset/rich-owls-smell.md diff --git a/.changeset/rich-owls-smell.md b/.changeset/rich-owls-smell.md new file mode 100644 index 0000000000..cc8c0fa5c4 --- /dev/null +++ b/.changeset/rich-owls-smell.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-model': patch +--- + +Remove requirement for 'target' property of EntityRelation diff --git a/packages/catalog-model/src/schema/shared/common.schema.json b/packages/catalog-model/src/schema/shared/common.schema.json index 7468bd9d70..77eb4a2612 100644 --- a/packages/catalog-model/src/schema/shared/common.schema.json +++ b/packages/catalog-model/src/schema/shared/common.schema.json @@ -32,7 +32,7 @@ "$id": "#relation", "type": "object", "description": "A directed relation from one entity to another.", - "required": ["type", "target", "targetRef"], + "required": ["type", "targetRef"], "additionalProperties": false, "properties": { "type": { diff --git a/packages/catalog-model/src/validation/entitySchemaValidator.test.ts b/packages/catalog-model/src/validation/entitySchemaValidator.test.ts index bc31c5d800..cf3339b098 100644 --- a/packages/catalog-model/src/validation/entitySchemaValidator.test.ts +++ b/packages/catalog-model/src/validation/entitySchemaValidator.test.ts @@ -365,11 +365,6 @@ describe('entitySchemaValidator', () => { expect(() => validator(entity)).toThrow(/relations/); }); - it('does reject missing relations.target', () => { - delete entity.relations[0].target; - expect(() => validator(entity)).toThrow(/relations/); - }); - it('does reject missing relations.targetRef', () => { delete entity.relations[0].targetRef; expect(() => validator(entity)).toThrow(/relations/);