From 1c3f6cd66c79e5b03120b2a723020e371e4beff3 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 13 Feb 2024 15:25:16 +0100 Subject: [PATCH 1/2] ensure metadata always includes 'source' --- types/schema/Metadata.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/schema/Metadata.ts b/types/schema/Metadata.ts index 35128ef0..aeb33919 100644 --- a/types/schema/Metadata.ts +++ b/types/schema/Metadata.ts @@ -5,7 +5,7 @@ import {FileType} from './File'; * @id #DigitalPlanningMetadata * @description Details of the digital planning service which sent this application */ -export type Metadata = BaseMetadata | PlanXMetadata; +export type Metadata = AnyProviderMetadata | PlanXMetadata; /** * @id #BaseMetadata @@ -25,6 +25,14 @@ export interface BaseMetadata { schema: URL; } +/** + * @id #AnyProviderMetadata + * @description Base metadata associated with applications submitted via any provider + */ +export interface AnyProviderMetadata extends BaseMetadata { + source: 'Any'; +} + /** * @id #RequestedFiles * @description File types requested by this service. Schema["files"] will be a subset of this list based on the user's journey through the service. From 1a3843d6c514b70fdb0297c675d7e44ed87ee70e Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 13 Feb 2024 15:34:03 +0100 Subject: [PATCH 2/2] generate schema --- schema/schema.json | 65 +++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/schema/schema.json b/schema/schema.json index b21b5d7d..f882f870 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -187,6 +187,40 @@ ], "type": "object" }, + "AnyProviderMetadata": { + "$id": "#AnyProviderMetadata", + "additionalProperties": false, + "description": "Base metadata associated with applications submitted via any provider", + "properties": { + "id": { + "$ref": "#/definitions/UUID", + "description": "Unique identifier for this application" + }, + "organisation": { + "description": "The reference code for the organisation responsible for processing this planning application, sourced from planning.data.gov.uk/dataset/local-authority", + "maxLength": 4, + "type": "string" + }, + "schema": { + "$ref": "#/definitions/URL" + }, + "source": { + "const": "Any", + "type": "string" + }, + "submittedAt": { + "$ref": "#/definitions/DateTime" + } + }, + "required": [ + "id", + "organisation", + "schema", + "source", + "submittedAt" + ], + "type": "object" + }, "Applicant": { "$id": "#Applicant", "anyOf": [ @@ -1571,35 +1605,6 @@ }, "type": "object" }, - "BaseMetadata": { - "$id": "#BaseMetadata", - "additionalProperties": false, - "description": "Minimum metadata expected for any application", - "properties": { - "id": { - "$ref": "#/definitions/UUID", - "description": "Unique identifier for this application" - }, - "organisation": { - "description": "The reference code for the organisation responsible for processing this planning application, sourced from planning.data.gov.uk/dataset/local-authority", - "maxLength": 4, - "type": "string" - }, - "schema": { - "$ref": "#/definitions/URL" - }, - "submittedAt": { - "$ref": "#/definitions/DateTime" - } - }, - "required": [ - "organisation", - "id", - "submittedAt", - "schema" - ], - "type": "object" - }, "Date": { "format": "date", "type": "string" @@ -4173,7 +4178,7 @@ "$id": "#DigitalPlanningMetadata", "anyOf": [ { - "$ref": "#/definitions/BaseMetadata" + "$ref": "#/definitions/AnyProviderMetadata" }, { "$ref": "#/definitions/PlanXMetadata"