From 36672592bad17b98500aee17450e0031743c9c89 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 7 Nov 2023 21:11:23 +0100 Subject: [PATCH 1/2] tidy up responses type --- schema/schema.json | 23 ++++++----------------- types/schema/Metadata.ts | 14 +++++++------- types/schema/Responses.ts | 8 +++++--- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/schema/schema.json b/schema/schema.json index 9bfb8dc6..8392ee9d 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -2857,14 +2857,7 @@ "description": "Details of the digital planning service which sent the application", "properties": { "flowId": { - "anyOf": [ - { - "$ref": "#/definitions/UUID" - }, - { - "type": "string" - } - ] + "$ref": "#/definitions/UUID" }, "name": { "type": "string" @@ -2891,14 +2884,7 @@ "$ref": "#/definitions/DateTime" }, "id": { - "anyOf": [ - { - "$ref": "#/definitions/UUID" - }, - { - "type": "string" - } - ] + "$ref": "#/definitions/UUID" }, "source": { "const": "PlanX", @@ -17507,9 +17493,12 @@ "type": "string" }, "url": { - "type": "string" + "$ref": "#/definitions/URL" } }, + "required": [ + "text" + ], "type": "object" }, "type": "array" diff --git a/types/schema/Metadata.ts b/types/schema/Metadata.ts index 47b1813a..7c91c091 100644 --- a/types/schema/Metadata.ts +++ b/types/schema/Metadata.ts @@ -1,14 +1,14 @@ import {DateTime, URL, UUID} from './../utils'; +/** + * @id #DigitalPlanningMetadata + * @description Details of the digital planning service which sent the application + */ export interface Metadata { - /** - * @id #DigitalPlanningMetadata - * @description Details of the digital planning service which sent the application - */ service: { - flowId: UUID | string; // @todo temp fix for failing UUID validation, sort out and tighten + flowId: UUID; name: string; - owner: string; + organisation: string; url: URL; }; session: { @@ -16,7 +16,7 @@ export interface Metadata { * @default PlanX */ source: 'PlanX'; - id: UUID | string; + id: UUID; createdAt: DateTime; submittedAt?: DateTime; }; diff --git a/types/schema/Responses.ts b/types/schema/Responses.ts index 604f74e7..0ef5ed61 100644 --- a/types/schema/Responses.ts +++ b/types/schema/Responses.ts @@ -1,3 +1,5 @@ +import { URL } from './../utils'; + /** * @id #Responses * @description The ordered list of questions, answers, and their metadata for the application @@ -7,14 +9,14 @@ export type Responses = QuestionAndResponses[]; export interface QuestionMetaData { autoAnswered?: boolean; policyRefs?: Array<{ - url?: string; - text?: string; + text: string; + url?: URL; }>; sectionName?: string; } export interface ResponseMetaData { - flags?: Array; // @todo connect to result/flags enum + flags?: Array; // @todo connect to result/flags enum, is this actually a list? options?: Array | Array; } From 84bf05d2b114d69456d921537573491e495da40d Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 7 Nov 2023 21:14:08 +0100 Subject: [PATCH 2/2] don't include unrelated changes --- types/schema/Metadata.ts | 14 +++++++------- types/schema/Responses.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/types/schema/Metadata.ts b/types/schema/Metadata.ts index 7c91c091..47b1813a 100644 --- a/types/schema/Metadata.ts +++ b/types/schema/Metadata.ts @@ -1,14 +1,14 @@ import {DateTime, URL, UUID} from './../utils'; -/** - * @id #DigitalPlanningMetadata - * @description Details of the digital planning service which sent the application - */ export interface Metadata { + /** + * @id #DigitalPlanningMetadata + * @description Details of the digital planning service which sent the application + */ service: { - flowId: UUID; + flowId: UUID | string; // @todo temp fix for failing UUID validation, sort out and tighten name: string; - organisation: string; + owner: string; url: URL; }; session: { @@ -16,7 +16,7 @@ export interface Metadata { * @default PlanX */ source: 'PlanX'; - id: UUID; + id: UUID | string; createdAt: DateTime; submittedAt?: DateTime; }; diff --git a/types/schema/Responses.ts b/types/schema/Responses.ts index 0ef5ed61..dfaa426a 100644 --- a/types/schema/Responses.ts +++ b/types/schema/Responses.ts @@ -1,4 +1,4 @@ -import { URL } from './../utils'; +import {URL} from './../utils'; /** * @id #Responses