diff --git a/examples/data/Property.ts b/examples/data/Property.ts index c5d3e2fc..a1acea3c 100644 --- a/examples/data/Property.ts +++ b/examples/data/Property.ts @@ -22,7 +22,22 @@ export const validProperty: Schema['data']['property'] = { description: 'HMO Parent', }, boundary: { - site: {type: 'GeoJSON Features TBD'}, + site: { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [ + [ + [-0.1186569035053321, 51.465703531871384], + [-0.1185938715934822, 51.465724418998775], + [-0.1184195280075143, 51.46552473766957], + [-0.11848390102387167, 51.4655038504508], + [-0.1186569035053321, 51.465703531871384], + ], + ], + }, + properties: null, + }, area: { squareMetres: 10000, hectares: 1, diff --git a/examples/data/Proposal.ts b/examples/data/Proposal.ts index 2914e7fd..4846a087 100644 --- a/examples/data/Proposal.ts +++ b/examples/data/Proposal.ts @@ -13,7 +13,22 @@ export const validProposal: Schema['data']['proposal'] = { ], description: 'This is a test application', boundary: { - site: {type: 'GeoJSON Features TBD'}, + site: { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [ + [ + [-0.1186569035053321, 51.465703531871384], + [-0.1185938715934822, 51.465724418998775], + [-0.1184195280075143, 51.46552473766957], + [-0.11848390102387167, 51.4655038504508], + [-0.1186569035053321, 51.465703531871384], + ], + ], + }, + properties: null, + }, area: { squareMetres: 10000, hectares: 1, diff --git a/examples/validExampleAgent.json b/examples/validExampleAgent.json index 732cd675..4e3f529c 100644 --- a/examples/validExampleAgent.json +++ b/examples/validExampleAgent.json @@ -99,7 +99,35 @@ }, "boundary": { "site": { - "type": "GeoJSON Features TBD" + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -0.1186569035053321, + 51.465703531871384 + ], + [ + -0.1185938715934822, + 51.465724418998775 + ], + [ + -0.1184195280075143, + 51.46552473766957 + ], + [ + -0.11848390102387167, + 51.4655038504508 + ], + [ + -0.1186569035053321, + 51.465703531871384 + ] + ] + ] + }, + "properties": null }, "area": { "squareMetres": 10000, @@ -145,7 +173,35 @@ "description": "This is a test application", "boundary": { "site": { - "type": "GeoJSON Features TBD" + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -0.1186569035053321, + 51.465703531871384 + ], + [ + -0.1185938715934822, + 51.465724418998775 + ], + [ + -0.1184195280075143, + 51.46552473766957 + ], + [ + -0.11848390102387167, + 51.4655038504508 + ], + [ + -0.1186569035053321, + 51.465703531871384 + ] + ] + ] + }, + "properties": null }, "area": { "squareMetres": 10000, diff --git a/examples/validExampleApplicant.json b/examples/validExampleApplicant.json index 291f1ab4..c637d513 100644 --- a/examples/validExampleApplicant.json +++ b/examples/validExampleApplicant.json @@ -94,7 +94,35 @@ }, "boundary": { "site": { - "type": "GeoJSON Features TBD" + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -0.1186569035053321, + 51.465703531871384 + ], + [ + -0.1185938715934822, + 51.465724418998775 + ], + [ + -0.1184195280075143, + 51.46552473766957 + ], + [ + -0.11848390102387167, + 51.4655038504508 + ], + [ + -0.1186569035053321, + 51.465703531871384 + ] + ] + ] + }, + "properties": null }, "area": { "squareMetres": 10000, @@ -140,7 +168,35 @@ "description": "This is a test application", "boundary": { "site": { - "type": "GeoJSON Features TBD" + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -0.1186569035053321, + 51.465703531871384 + ], + [ + -0.1185938715934822, + 51.465724418998775 + ], + [ + -0.1184195280075143, + 51.46552473766957 + ], + [ + -0.11848390102387167, + 51.4655038504508 + ], + [ + -0.1186569035053321, + 51.465703531871384 + ] + ] + ] + }, + "properties": null }, "area": { "squareMetres": 10000, diff --git a/schema/schema.json b/schema/schema.json index c38bbc4c..a9a86548 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -100,7 +100,7 @@ "type": "string" }, "noticeDate": { - "type": "string" + "$ref": "#/definitions/Date" }, "noticeGiven": { "type": "boolean" @@ -938,7 +938,7 @@ "type": "string" }, "noticeDate": { - "type": "string" + "$ref": "#/definitions/Date" }, "noticeGiven": { "type": "boolean" @@ -1026,6 +1026,10 @@ }, "type": "object" }, + "Date": { + "format": "date", + "type": "string" + }, "DateTime": { "format": "date-time", "type": "string" @@ -2511,7 +2515,8 @@ "description": "Details of the pre-application, if applicable", "properties": { "date": { - "$ref": "#/definitions/DateTime" + "format": "date-time", + "type": "string" }, "officer": { "type": "string" @@ -12750,10 +12755,12 @@ "additionalProperties": false, "properties": { "completion": { - "$ref": "#/definitions/DateTime" + "format": "date-time", + "type": "string" }, "start": { - "$ref": "#/definitions/DateTime" + "format": "date-time", + "type": "string" } }, "required": [ @@ -12780,10 +12787,12 @@ "additionalProperties": false, "properties": { "completion": { - "$ref": "#/definitions/DateTime" + "format": "date-time", + "type": "string" }, "start": { - "$ref": "#/definitions/DateTime" + "format": "date-time", + "type": "string" } }, "required": [ diff --git a/types/schema/data/Applicant.ts b/types/schema/data/Applicant.ts index 24f898ef..bfda41d3 100644 --- a/types/schema/data/Applicant.ts +++ b/types/schema/data/Applicant.ts @@ -1,4 +1,4 @@ -import {DateTime, Email} from '../../utils'; +import {Date, Email} from '../../utils'; import {User} from './User'; /** @@ -20,7 +20,7 @@ export interface BaseApplicant { name: string; address: AddressInput | string; noticeGiven: boolean; - noticeDate?: string; // @todo type DateTime throws test error + noticeDate?: Date; }[]; }; contact: UserContact; diff --git a/types/schema/data/Application.ts b/types/schema/data/Application.ts index d14028f2..96be3d40 100644 --- a/types/schema/data/Application.ts +++ b/types/schema/data/Application.ts @@ -49,7 +49,7 @@ export interface ApplicationFee { */ export interface PreApplication { reference: string; - date: DateTime; + date: Date; officer: string; summary: string; } diff --git a/types/schema/data/Property.ts b/types/schema/data/Property.ts index 93f8ad54..1be5c18e 100644 --- a/types/schema/data/Property.ts +++ b/types/schema/data/Property.ts @@ -1,5 +1,5 @@ import {PropertyTypes} from '../../enums/PropertyTypes'; -import {Area} from '../../utils'; +import {Area, GeoJSON} from '../../utils'; /** * @id #Property @@ -17,7 +17,7 @@ export interface UKProperty { localAuthorityDistrict: string[]; type: PropertyType; boundary?: { - site: Record; // @todo use GeoJSON from utils here, but ajv tests failing + site: GeoJSON; area: Area; }; constraints?: { diff --git a/types/schema/data/Proposal.ts b/types/schema/data/Proposal.ts index b90ccefc..397bff9e 100644 --- a/types/schema/data/Proposal.ts +++ b/types/schema/data/Proposal.ts @@ -1,6 +1,6 @@ import {ProjectTypes} from '../../enums/ProjectTypes'; import {VehicleParking} from '../../enums/VehicleParking'; -import {Area, DateTime} from '../../utils'; +import {Area, DateTime, GeoJSON} from '../../utils'; /** * @id #Proposal @@ -10,17 +10,17 @@ export interface Proposal { projectType: ProjectType[]; description: string; boundary?: { - site: Record; // @todo use GeoJSON from utils here, but ajv tests failing + site: GeoJSON; area: Area; }; date?: { - start: DateTime; - completion?: DateTime; + start: Date; + completion?: Date; }; retro?: { date: { - start: DateTime; - completion: DateTime; + start: Date; + completion: Date; }; }; details?: ProposalDetails; diff --git a/types/utils.ts b/types/utils.ts index b95cc885..1f03cd96 100644 --- a/types/utils.ts +++ b/types/utils.ts @@ -1,3 +1,5 @@ +/** see available @format types here https://json-schema.org/understanding-json-schema/reference/string.html#built-in-formats */ + /** * @format uuid */ @@ -20,9 +22,14 @@ export type URL = string; export type DateTime = string; /** - * @format geojson + * @format date + */ +export type Date = string; + +/** + * @id #GeoJSON */ -export type GeoJSON = string; +export type GeoJSON = Record; /** * @id #Area