From 55dbc87f5ef800a6fb2afcc423aff7893ad7c798 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Thu, 4 Jul 2024 08:48:38 +0200 Subject: [PATCH] fix: for intersecting planning constraints, allow `entities` to be optional in favor of more specific type (#196) --- .../lawfulDevelopmentCertificate/existing.ts | 1 - examples/data/listedBuildingConsent.ts | 2 - .../priorApproval/convertCommercialToHome.ts | 2 - .../data/priorApproval/extendUniversity.ts | 1 - .../existing.json | 3 +- examples/listedBuildingConsent.json | 6 +- .../convertCommercialToHome.json | 6 +- examples/priorApproval/extendUniversity.json | 3 +- schema/schema.json | 521 ++++-------------- types/enums/PlanningConstraints.ts | 2 +- types/schema/data/Property.ts | 2 +- 11 files changed, 124 insertions(+), 425 deletions(-) diff --git a/examples/data/lawfulDevelopmentCertificate/existing.ts b/examples/data/lawfulDevelopmentCertificate/existing.ts index efdd09a6..4096474f 100644 --- a/examples/data/lawfulDevelopmentCertificate/existing.ts +++ b/examples/data/lawfulDevelopmentCertificate/existing.ts @@ -201,7 +201,6 @@ export const lawfulDevelopmentCertificateExisting: Schema = { value: 'designated', description: 'Designated land', intersects: true, - entities: [], }, { value: 'nature.SAC', diff --git a/examples/data/listedBuildingConsent.ts b/examples/data/listedBuildingConsent.ts index 68ab24e2..abce8801 100644 --- a/examples/data/listedBuildingConsent.ts +++ b/examples/data/listedBuildingConsent.ts @@ -104,7 +104,6 @@ export const listedBuildingConsent: Schema = { value: 'listed', description: 'Listed Building', intersects: true, - entities: [], }, { value: 'article4', @@ -134,7 +133,6 @@ export const listedBuildingConsent: Schema = { value: 'designated', description: 'Designated land', intersects: true, - entities: [], }, { value: 'nature.SAC', diff --git a/examples/data/priorApproval/convertCommercialToHome.ts b/examples/data/priorApproval/convertCommercialToHome.ts index 1e6c821e..159ca94f 100644 --- a/examples/data/priorApproval/convertCommercialToHome.ts +++ b/examples/data/priorApproval/convertCommercialToHome.ts @@ -123,7 +123,6 @@ export const priorApprovalConvertCommercialToHome: Schema = { value: 'designated', description: 'Designated land', intersects: true, - entities: [], }, { value: 'nature.SAC', @@ -174,7 +173,6 @@ export const priorApprovalConvertCommercialToHome: Schema = { value: 'listed.grade.II', description: 'Listed Building - Grade II', intersects: true, - entities: [], }, { value: 'listed.grade.II*', diff --git a/examples/data/priorApproval/extendUniversity.ts b/examples/data/priorApproval/extendUniversity.ts index 690907d7..dacd79a5 100644 --- a/examples/data/priorApproval/extendUniversity.ts +++ b/examples/data/priorApproval/extendUniversity.ts @@ -95,7 +95,6 @@ export const priorApprovalExtendUniversity: Schema = { value: 'designated', description: 'Designated land', intersects: true, - entities: [], }, { value: 'nature.SAC', diff --git a/examples/lawfulDevelopmentCertificate/existing.json b/examples/lawfulDevelopmentCertificate/existing.json index 7d502db6..f8f49c7f 100644 --- a/examples/lawfulDevelopmentCertificate/existing.json +++ b/examples/lawfulDevelopmentCertificate/existing.json @@ -288,8 +288,7 @@ { "value": "designated", "description": "Designated land", - "intersects": true, - "entities": [] + "intersects": true }, { "value": "nature.SAC", diff --git a/examples/listedBuildingConsent.json b/examples/listedBuildingConsent.json index 986a2e6f..86eac98e 100644 --- a/examples/listedBuildingConsent.json +++ b/examples/listedBuildingConsent.json @@ -101,8 +101,7 @@ { "value": "listed", "description": "Listed Building", - "intersects": true, - "entities": [] + "intersects": true }, { "value": "article4", @@ -131,8 +130,7 @@ { "value": "designated", "description": "Designated land", - "intersects": true, - "entities": [] + "intersects": true }, { "value": "nature.SAC", diff --git a/examples/priorApproval/convertCommercialToHome.json b/examples/priorApproval/convertCommercialToHome.json index e566d681..0879845e 100644 --- a/examples/priorApproval/convertCommercialToHome.json +++ b/examples/priorApproval/convertCommercialToHome.json @@ -120,8 +120,7 @@ { "value": "designated", "description": "Designated land", - "intersects": true, - "entities": [] + "intersects": true }, { "value": "nature.SAC", @@ -171,8 +170,7 @@ { "value": "listed.grade.II", "description": "Listed Building - Grade II", - "intersects": true, - "entities": [] + "intersects": true }, { "value": "listed.grade.II*", diff --git a/examples/priorApproval/extendUniversity.json b/examples/priorApproval/extendUniversity.json index d6e8d413..a228c0a8 100644 --- a/examples/priorApproval/extendUniversity.json +++ b/examples/priorApproval/extendUniversity.json @@ -92,8 +92,7 @@ { "value": "designated", "description": "Designated land", - "intersects": true, - "entities": [] + "intersects": true }, { "value": "nature.SAC", diff --git a/schema/schema.json b/schema/schema.json index e2492d1d..12e566ca 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -7893,19 +7893,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8588,19 +8579,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8613,7 +8595,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8627,19 +8608,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8652,7 +8624,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8666,19 +8637,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8691,7 +8653,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8705,19 +8666,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8730,7 +8682,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8744,19 +8695,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8769,7 +8711,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8783,19 +8724,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8808,7 +8740,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8822,19 +8753,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8847,7 +8769,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8861,19 +8782,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8886,7 +8798,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8900,19 +8811,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8925,7 +8827,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8939,19 +8840,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -8964,7 +8856,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -8978,19 +8869,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9003,7 +8885,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9017,19 +8898,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9042,7 +8914,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9056,19 +8927,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9081,7 +8943,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9095,19 +8956,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9120,7 +8972,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9134,19 +8985,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9159,7 +9001,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9173,19 +9014,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9198,7 +9030,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9212,19 +9043,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9237,7 +9059,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9251,19 +9072,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9276,7 +9088,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9290,19 +9101,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9315,7 +9117,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9329,19 +9130,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9354,7 +9146,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9368,19 +9159,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9393,7 +9175,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9407,19 +9188,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9432,7 +9204,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9446,19 +9217,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9471,7 +9233,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9485,19 +9246,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9510,7 +9262,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9524,19 +9275,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9549,7 +9291,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9563,19 +9304,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9588,7 +9320,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9602,19 +9333,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9627,7 +9349,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], @@ -9641,19 +9362,10 @@ "type": "string" }, "entities": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/Entity" - }, - "type": "array" - }, - { - "maxItems": 0, - "minItems": 0, - "type": "array" - } - ] + "items": { + "$ref": "#/definitions/Entity" + }, + "type": "array" }, "intersects": { "const": true, @@ -9666,7 +9378,6 @@ }, "required": [ "description", - "entities", "intersects", "value" ], diff --git a/types/enums/PlanningConstraints.ts b/types/enums/PlanningConstraints.ts index a08af89d..ef7b87aa 100644 --- a/types/enums/PlanningConstraints.ts +++ b/types/enums/PlanningConstraints.ts @@ -60,7 +60,7 @@ type NonIntersectingPlanningDesignation = { */ type IntersectingPlanningDesignation = { intersects: true; - entities: Entity[] | []; + entities?: Entity[]; } & BasePlanningDesignation; /** diff --git a/types/schema/data/Property.ts b/types/schema/data/Property.ts index a2885ae5..77c4063e 100644 --- a/types/schema/data/Property.ts +++ b/types/schema/data/Property.ts @@ -211,7 +211,7 @@ type NonIntersectingPlanningConstraint = { */ type IntersectingPlanningConstraint = { intersects: true; - entities: Entity[] | []; + entities: Entity[]; } & BasePlanningConstraint; /**