From 81ad720468528121b0dbe465e5b3a322062abe5d Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 7 Aug 2024 17:54:47 +0200 Subject: [PATCH] chore: add a mock field to demonstrate how new simplified enums are generating (#235) --- schemas/prototypeApplication.json | 73 ++++++++++++++++++- .../prototypeApplication/data/Proposal.ts | 9 +++ types/schemas/prototypeApplication/index.ts | 2 + 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 types/schemas/prototypeApplication/data/Proposal.ts diff --git a/schemas/prototypeApplication.json b/schemas/prototypeApplication.json index 2d33b06a..419e92fa 100644 --- a/schemas/prototypeApplication.json +++ b/schemas/prototypeApplication.json @@ -26,6 +26,37 @@ ], "type": "object" }, + "OpenSpaceDesignation": { + "$id": "#OpenSpaceDesignation", + "anyOf": [ + { + "const": "greenBelt", + "description": "Green Belt", + "type": "string" + }, + { + "const": "local", + "description": "Local Open Spaces", + "type": "string" + }, + { + "const": "metropolitan", + "description": "Metropolitan Open Land", + "type": "string" + }, + { + "const": "none", + "description": "Not designated", + "type": "string" + }, + { + "const": "other", + "description": "Other designation", + "type": "string" + } + ], + "description": "Designations of natural open spaces" + }, "PAApplication": { "additionalProperties": false, "properties": { @@ -38,13 +69,17 @@ "application": { "$ref": "#/definitions/ApplicationDataBase" }, + "proposal": { + "$ref": "#/definitions/ProposalBase" + }, "user": { "$ref": "#/definitions/UserBase" } }, "required": [ "user", - "application" + "application", + "proposal" ], "type": "object" } @@ -281,13 +316,17 @@ "application": { "$ref": "#/definitions/PPApplicationData" }, + "proposal": { + "$ref": "#/definitions/ProposalBase" + }, "user": { "$ref": "#/definitions/PPUser" } }, "required": [ "user", - "application" + "application", + "proposal" ], "type": "object" } @@ -480,6 +519,30 @@ ], "type": "object" }, + "ProposalBase": { + "additionalProperties": false, + "properties": { + "nature": { + "additionalProperties": false, + "properties": { + "openSpaces": { + "additionalProperties": false, + "properties": { + "designation": { + "$ref": "#/definitions/OpenSpaceDesignation" + } + }, + "required": [ + "designation" + ], + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, "UserBase": { "additionalProperties": false, "properties": { @@ -509,13 +572,17 @@ "application": { "$ref": "#/definitions/WTTApplicationData" }, + "proposal": { + "$ref": "#/definitions/ProposalBase" + }, "user": { "$ref": "#/definitions/WTTUser" } }, "required": [ "user", - "application" + "application", + "proposal" ], "type": "object" } diff --git a/types/schemas/prototypeApplication/data/Proposal.ts b/types/schemas/prototypeApplication/data/Proposal.ts new file mode 100644 index 00000000..49158080 --- /dev/null +++ b/types/schemas/prototypeApplication/data/Proposal.ts @@ -0,0 +1,9 @@ +import {OpenSpaceDesignation} from '../enums/OpenSpace'; + +export interface ProposalBase { + nature?: { + openSpaces?: { + designation: OpenSpaceDesignation; + }; + }; +} diff --git a/types/schemas/prototypeApplication/index.ts b/types/schemas/prototypeApplication/index.ts index 3db357bc..37e80c95 100644 --- a/types/schemas/prototypeApplication/index.ts +++ b/types/schemas/prototypeApplication/index.ts @@ -1,4 +1,5 @@ import {ApplicationData} from './data/ApplicationData'; +import {ProposalBase} from './data/Proposal'; import {User} from './data/User'; import { ApplicationType, @@ -22,6 +23,7 @@ interface ApplicationSpecification< data: { user: User; application: ApplicationData; + proposal: ProposalBase; }; }