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" 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.