From 43b7cecdd561cb1bc9f8d29e03cb94e3fbd9c43e Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 24 Oct 2023 12:40:29 +0200 Subject: [PATCH 1/5] try using npm package @types/geojson, schema build fails --- package.json | 1 + pnpm-lock.yaml | 7 +++++++ types/enums/ProjectTypes.ts | 7 +++++-- types/schema/data/Property.ts | 3 ++- types/schema/data/Proposal.ts | 3 ++- types/utils.ts | 5 ----- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 1261536b..29848e84 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "author": "Open Systems Lab", "license": "MPL2", "devDependencies": { + "@types/geojson": "^7946.0.12", "@types/node": "18.16.1", "gts": "^5.0.0", "husky": "^8.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b9777a73..c7b40fb9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,6 +19,9 @@ dependencies: version: 10.9.1(@types/node@18.16.1)(typescript@5.1.6) devDependencies: + '@types/geojson': + specifier: ^7946.0.12 + version: 7946.0.12 '@types/node': specifier: 18.16.1 version: 18.16.1 @@ -414,6 +417,10 @@ packages: resolution: {integrity: sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==} dev: true + /@types/geojson@7946.0.12: + resolution: {integrity: sha512-uK2z1ZHJyC0nQRbuovXFt4mzXDwf27vQeUWNhfKGwRcWW429GOhP8HxUHlM6TLH4bzmlv/HlEjpvJh3JfmGsAA==} + dev: true + /@types/json-schema@7.0.12: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} diff --git a/types/enums/ProjectTypes.ts b/types/enums/ProjectTypes.ts index e40e79d5..3a939d59 100644 --- a/types/enums/ProjectTypes.ts +++ b/types/enums/ProjectTypes.ts @@ -2,6 +2,7 @@ * Values of `data.proposal.projectType` */ export const ProjectTypes = { + alter: 'Alter a building', 'alter.balcony': 'Add or alter a balcony', 'alter.bayWindow': 'Add or remove a bay window', 'alter.bayWindow.add': 'Add a bay window', @@ -124,7 +125,7 @@ export const ProjectTypes = { 'alter.swimmingPool.indoor': 'Install an indoor swimming pool', 'alter.swimmingPool.outdoor': 'Install an outdoor swimming pool', 'alter.trees': 'Changes to trees or hedges', - changeOfUse: 'Convert a building to a different use', + changeOfUse: 'Change the use of a building', 'changeofUse.annexe': 'Convert part of the property into a granny flat (residential annexe)', 'changeOfUse.caravans': 'Use a caravan or mobile home on the property', @@ -143,6 +144,7 @@ export const ProjectTypes = { 'demolish.outbuildings': 'Demolish an outbuilding (such as a garage or barn)', 'demolish.part': 'Demolish part of a building (such as an extension)', 'demolish.replace': 'Demolish a building and build homes in its place', + extend: 'Extend a building or add an outbuilding', 'extend.basement': 'Add a basement extension', 'extend.basement.extend': 'Enlarge a basement', 'extend.basement.lightwell': 'Add a lightwell', @@ -197,7 +199,7 @@ export const ProjectTypes = { 'internal.staircases': 'Alter internal staircases', 'internal.walls': 'Alter internal walls', 'internal.windows.openings': 'Alter internal window openings', - new: 'Another type of building', + new: 'Add another type of building', 'new.agriculture': 'Agricultural buildings', 'new.agriculture.glassHouse': 'Agricultural buildings - glass house', 'new.agriculture.mining': 'Agricultural buildings - mining', @@ -217,6 +219,7 @@ export const ProjectTypes = { 'new.temporaryStructure': 'Erect a temporary structure for historic visitor attractions and listed buildings', 'new.warehouse': 'Storage or distribution premises', + unit: 'Change of units', 'unit.merge': 'Convert two or more properties into one', 'unit.subdivide': 'Convert a home or part of a home into flats', }; diff --git a/types/schema/data/Property.ts b/types/schema/data/Property.ts index 8460631f..483183fb 100644 --- a/types/schema/data/Property.ts +++ b/types/schema/data/Property.ts @@ -1,6 +1,7 @@ +import {GeoJSON} from 'geojson'; import {PlanningConstraints} from '../../enums/PlanningConstraints'; import {PropertyTypes} from '../../enums/PropertyTypes'; -import {Area, GeoJSON, URL} from '../../utils'; +import {Area, URL} from '../../utils'; /** * @id #Property diff --git a/types/schema/data/Proposal.ts b/types/schema/data/Proposal.ts index b1e6ae82..38a42031 100644 --- a/types/schema/data/Proposal.ts +++ b/types/schema/data/Proposal.ts @@ -1,6 +1,7 @@ +import {GeoJSON} from 'geojson'; import {ProjectTypes} from '../../enums/ProjectTypes'; import {VehicleParking} from '../../enums/VehicleParking'; -import {Area, Date, GeoJSON} from '../../utils'; +import {Area, Date} from '../../utils'; /** * @id #Proposal diff --git a/types/utils.ts b/types/utils.ts index 1f03cd96..07574b8a 100644 --- a/types/utils.ts +++ b/types/utils.ts @@ -26,11 +26,6 @@ export type DateTime = string; */ export type Date = string; -/** - * @id #GeoJSON - */ -export type GeoJSON = Record; - /** * @id #Area */ From 474669b1e700e9e4539b9cab600cc2be56157597 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 24 Oct 2023 16:14:56 +0200 Subject: [PATCH 2/5] update package --- package.json | 2 +- pnpm-lock.yaml | 38 ++-- schema/schema.json | 423 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 440 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 29848e84..f6006db2 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "dependencies": { "ajv": "^8.12.0", "ajv-formats": "^2.1.1", - "ts-json-schema-generator": "^1.2.0", + "ts-json-schema-generator": "^1.4.0", "ts-node": "^10.9.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c7b40fb9..b01d616d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ dependencies: specifier: ^2.1.1 version: 2.1.1(ajv@8.12.0) ts-json-schema-generator: - specifier: ^1.2.0 - version: 1.2.0 + specifier: ^1.4.0 + version: 1.4.0 ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@18.16.1)(typescript@5.1.6) @@ -843,9 +843,9 @@ packages: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true - /commander@9.5.0: - resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} - engines: {node: ^12.20.0 || >=14} + /commander@11.1.0: + resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} + engines: {node: '>=16'} dev: false /concat-map@0.0.1: @@ -1294,8 +1294,8 @@ packages: /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true @@ -2142,7 +2142,7 @@ packages: engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /run-applescript@5.0.0: @@ -2374,18 +2374,18 @@ packages: engines: {node: '>=8'} dev: true - /ts-json-schema-generator@1.2.0: - resolution: {integrity: sha512-tUMeO3ZvA12d3HHh7T/AK8W5hmUhDRNtqWRHSMN3ZRbUFt+UmV0oX8k1RK4SA+a+BKNHpmW2v06MS49e8Fi3Yg==} + /ts-json-schema-generator@1.4.0: + resolution: {integrity: sha512-wm8vyihmGgYpxrqRshmYkWGNwEk+sf3xV2rUgxv8Ryeh7bSpMO7pZQOht+2rS002eDkFTxR7EwRPXVzrS0WJTg==} engines: {node: '>=10.0.0'} hasBin: true dependencies: '@types/json-schema': 7.0.12 - commander: 9.5.0 + commander: 11.1.0 glob: 8.1.0 json5: 2.2.3 normalize-path: 3.0.0 safe-stable-stringify: 2.4.3 - typescript: 4.9.5 + typescript: 5.2.2 dev: false /ts-node@10.9.1(@types/node@18.16.1)(typescript@5.1.6): @@ -2474,17 +2474,17 @@ packages: engines: {node: '>=8'} dev: true - /typescript@4.9.5: - resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} - engines: {node: '>=4.2.0'} - hasBin: true - dev: false - /typescript@5.1.6: resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} engines: {node: '>=14.17'} hasBin: true + /typescript@5.2.2: + resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} + engines: {node: '>=14.17'} + hasBin: true + dev: false + /ufo@1.2.0: resolution: {integrity: sha512-RsPyTbqORDNDxqAdQPQBpgqhWle1VcTSou/FraClYlHf6TZnQcGslpLcAphNR+sQW4q5lLWLbOsRlh9j24baQg==} dev: true @@ -2565,7 +2565,7 @@ packages: postcss: 8.4.31 rollup: 3.28.0 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /vitest@0.34.1: diff --git a/schema/schema.json b/schema/schema.json index c253321d..dca8c546 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -897,6 +897,27 @@ ], "type": "object" }, + "BBox": { + "anyOf": [ + { + "items": { + "type": "number" + }, + "maxItems": 4, + "minItems": 4, + "type": "array" + }, + { + "items": { + "type": "number" + }, + "maxItems": 6, + "minItems": 6, + "type": "array" + } + ], + "description": "Bounding box https://tools.ietf.org/html/rfc7946#section-5" + }, "BaseApplicant": { "$id": "#BaseApplicant", "additionalProperties": false, @@ -1047,6 +1068,104 @@ "format": "email", "type": "string" }, + "Feature": { + "additionalProperties": false, + "description": "A feature object which contains a geometry and associated properties. https://tools.ietf.org/html/rfc7946#section-3.2", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "geometry": { + "$ref": "#/definitions/Geometry", + "description": "The feature's geometry" + }, + "id": { + "description": "A value that uniquely identifies this feature in a https://tools.ietf.org/html/rfc7946#section-3.2.", + "type": [ + "string", + "number" + ] + }, + "properties": { + "$ref": "#/definitions/GeoJsonProperties", + "description": "Properties associated with this feature." + }, + "type": { + "const": "Feature", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "geometry", + "properties", + "type" + ], + "type": "object" + }, + "Feature": { + "additionalProperties": false, + "description": "A feature object which contains a geometry and associated properties. https://tools.ietf.org/html/rfc7946#section-3.2", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "geometry": { + "$ref": "#/definitions/Geometry", + "description": "The feature's geometry" + }, + "id": { + "description": "A value that uniquely identifies this feature in a https://tools.ietf.org/html/rfc7946#section-3.2.", + "type": [ + "string", + "number" + ] + }, + "properties": { + "$ref": "#/definitions/GeoJsonProperties", + "description": "Properties associated with this feature." + }, + "type": { + "const": "Feature", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "geometry", + "properties", + "type" + ], + "type": "object" + }, + "FeatureCollection": { + "additionalProperties": false, + "description": "A collection of feature objects. https://tools.ietf.org/html/rfc7946#section-3.3", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "features": { + "items": { + "$ref": "#/definitions/Feature%3CGeometry%2CGeoJsonProperties%3E" + }, + "type": "array" + }, + "type": { + "const": "FeatureCollection", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "features", + "type" + ], + "type": "object" + }, "File": { "$id": "#File", "additionalProperties": false, @@ -1744,7 +1863,105 @@ "description": "Types of planning documents and drawings" }, "GeoJSON": { - "$id": "#GeoJSON", + "anyOf": [ + { + "$ref": "#/definitions/Geometry" + }, + { + "$ref": "#/definitions/Feature" + }, + { + "$ref": "#/definitions/FeatureCollection" + } + ], + "description": "Union of GeoJSON objects." + }, + "GeoJsonProperties": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ] + }, + "Geometry": { + "anyOf": [ + { + "$ref": "#/definitions/Point" + }, + { + "$ref": "#/definitions/MultiPoint" + }, + { + "$ref": "#/definitions/LineString" + }, + { + "$ref": "#/definitions/MultiLineString" + }, + { + "$ref": "#/definitions/Polygon" + }, + { + "$ref": "#/definitions/MultiPolygon" + }, + { + "$ref": "#/definitions/GeometryCollection" + } + ], + "description": "Geometry object. https://tools.ietf.org/html/rfc7946#section-3" + }, + "GeometryCollection": { + "additionalProperties": false, + "description": "Geometry Collection https://tools.ietf.org/html/rfc7946#section-3.1.8", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "geometries": { + "items": { + "$ref": "#/definitions/Geometry" + }, + "type": "array" + }, + "type": { + "const": "GeometryCollection", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "geometries", + "type" + ], + "type": "object" + }, + "LineString": { + "additionalProperties": false, + "description": "LineString geometry object. https://tools.ietf.org/html/rfc7946#section-3.1.4", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "coordinates": { + "items": { + "$ref": "#/definitions/Position" + }, + "type": "array" + }, + "type": { + "const": "LineString", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "coordinates", + "type" + ], "type": "object" }, "LondonDetails": { @@ -2582,6 +2799,93 @@ ], "type": "object" }, + "MultiLineString": { + "additionalProperties": false, + "description": "MultiLineString geometry object. https://tools.ietf.org/html/rfc7946#section-3.1.5", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "coordinates": { + "items": { + "items": { + "$ref": "#/definitions/Position" + }, + "type": "array" + }, + "type": "array" + }, + "type": { + "const": "MultiLineString", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "coordinates", + "type" + ], + "type": "object" + }, + "MultiPoint": { + "additionalProperties": false, + "description": "MultiPoint geometry object. https://tools.ietf.org/html/rfc7946#section-3.1.3", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "coordinates": { + "items": { + "$ref": "#/definitions/Position" + }, + "type": "array" + }, + "type": { + "const": "MultiPoint", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "coordinates", + "type" + ], + "type": "object" + }, + "MultiPolygon": { + "additionalProperties": false, + "description": "MultiPolygon geometry object. https://tools.ietf.org/html/rfc7946#section-3.1.7", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "coordinates": { + "items": { + "items": { + "items": { + "$ref": "#/definitions/Position" + }, + "type": "array" + }, + "type": "array" + }, + "type": "array" + }, + "type": { + "const": "MultiPolygon", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "coordinates", + "type" + ], + "type": "object" + }, "OSAddress": { "$id": "#OSAddress", "additionalProperties": false, @@ -4788,6 +5092,65 @@ ], "description": "Planning constraints that overlap with the property site boundary determined by spatial queries against Planning Data (planning.data.gov.uk) and Ordnance Survey" }, + "Point": { + "additionalProperties": false, + "description": "Point geometry object. https://tools.ietf.org/html/rfc7946#section-3.1.2", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "coordinates": { + "$ref": "#/definitions/Position" + }, + "type": { + "const": "Point", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "coordinates", + "type" + ], + "type": "object" + }, + "Polygon": { + "additionalProperties": false, + "description": "Polygon geometry object. https://tools.ietf.org/html/rfc7946#section-3.1.6", + "properties": { + "bbox": { + "$ref": "#/definitions/BBox", + "description": "Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5" + }, + "coordinates": { + "items": { + "items": { + "$ref": "#/definitions/Position" + }, + "type": "array" + }, + "type": "array" + }, + "type": { + "const": "Polygon", + "description": "Specifies the type of GeoJSON object.", + "type": "string" + } + }, + "required": [ + "coordinates", + "type" + ], + "type": "object" + }, + "Position": { + "description": "A Position is an array of coordinates. https://tools.ietf.org/html/rfc7946#section-3.1.1 Array should contain between two and three elements. The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values), but the current specification only allows X, Y, and (optionally) Z to be defined.", + "items": { + "type": "number" + }, + "type": "array" + }, "PreApplication": { "$id": "#PreApplication", "additionalProperties": false, @@ -4817,6 +5180,24 @@ "ProjectType": { "$id": "#ProjectType", "anyOf": [ + { + "additionalProperties": false, + "properties": { + "description": { + "const": "Alter a building", + "type": "string" + }, + "value": { + "const": "alter", + "type": "string" + } + }, + "required": [ + "value", + "description" + ], + "type": "object" + }, { "additionalProperties": false, "properties": { @@ -6819,7 +7200,7 @@ "additionalProperties": false, "properties": { "description": { - "const": "Convert a building to a different use", + "const": "Change the use of a building", "type": "string" }, "value": { @@ -7121,6 +7502,24 @@ ], "type": "object" }, + { + "additionalProperties": false, + "properties": { + "description": { + "const": "Extend a building or add an outbuilding", + "type": "string" + }, + "value": { + "const": "extend", + "type": "string" + } + }, + "required": [ + "value", + "description" + ], + "type": "object" + }, { "additionalProperties": false, "properties": { @@ -8007,7 +8406,7 @@ "additionalProperties": false, "properties": { "description": { - "const": "Another type of building", + "const": "Add another type of building", "type": "string" }, "value": { @@ -8345,6 +8744,24 @@ ], "type": "object" }, + { + "additionalProperties": false, + "properties": { + "description": { + "const": "Change of units", + "type": "string" + }, + "value": { + "const": "unit", + "type": "string" + } + }, + "required": [ + "value", + "description" + ], + "type": "object" + }, { "additionalProperties": false, "properties": { From eef023375915215e797abc3f4d20a3bdedc4055c Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 25 Oct 2023 10:11:50 +0200 Subject: [PATCH 3/5] tidy up documentation --- schema/schema.json | 251 ++++++++++++++----------------- types/enums/PropertyTypes.ts | 2 +- types/schema/data/Applicant.ts | 24 +-- types/schema/data/Application.ts | 30 ++-- types/schema/data/Property.ts | 3 +- types/schema/data/Proposal.ts | 18 ++- 6 files changed, 161 insertions(+), 167 deletions(-) diff --git a/schema/schema.json b/schema/schema.json index dca8c546..6eceaf1e 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -72,54 +72,7 @@ "type": "string" }, "ownership": { - "additionalProperties": false, - "properties": { - "certificate": { - "enum": [ - "a", - "b", - "c", - "d" - ], - "type": "string" - }, - "noticeGiven": { - "type": "boolean" - }, - "owners": { - "items": { - "additionalProperties": false, - "properties": { - "address": { - "anyOf": [ - { - "$ref": "#/definitions/AddressInput" - }, - { - "type": "string" - } - ] - }, - "name": { - "type": "string" - }, - "noticeDate": { - "$ref": "#/definitions/Date" - } - }, - "required": [ - "name", - "address" - ], - "type": "object" - }, - "type": "array" - } - }, - "required": [ - "certificate" - ], - "type": "object" + "$ref": "#/definitions/Ownership" }, "siteContact": { "$ref": "#/definitions/SiteContact" @@ -162,39 +115,7 @@ "description": "Information about this planning application", "properties": { "declaration": { - "additionalProperties": false, - "properties": { - "accurate": { - "type": "boolean" - }, - "connection": { - "additionalProperties": false, - "properties": { - "description": { - "type": "string" - }, - "value": { - "enum": [ - "employee", - "relation.employee", - "electedMember", - "relation.electedMember", - "none" - ], - "type": "string" - } - }, - "required": [ - "value" - ], - "type": "object" - } - }, - "required": [ - "accurate", - "connection" - ], - "type": "object" + "$ref": "#/definitions/ApplicationDeclaration" }, "fee": { "$ref": "#/definitions/ApplicationFee" @@ -213,6 +134,43 @@ ], "type": "object" }, + "ApplicationDeclaration": { + "$id": "#ApplicationDeclaration", + "additionalProperties": false, + "description": "Declarations about the accuracy of this application and any personal connections to the receiving authority", + "properties": { + "accurate": { + "type": "boolean" + }, + "connection": { + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "value": { + "enum": [ + "employee", + "relation.employee", + "electedMember", + "relation.electedMember", + "none" + ], + "type": "string" + } + }, + "required": [ + "value" + ], + "type": "object" + } + }, + "required": [ + "accurate", + "connection" + ], + "type": "object" + }, "ApplicationFee": { "$id": "#ApplicationFee", "additionalProperties": false, @@ -940,54 +898,7 @@ "type": "string" }, "ownership": { - "additionalProperties": false, - "properties": { - "certificate": { - "enum": [ - "a", - "b", - "c", - "d" - ], - "type": "string" - }, - "noticeGiven": { - "type": "boolean" - }, - "owners": { - "items": { - "additionalProperties": false, - "properties": { - "address": { - "anyOf": [ - { - "$ref": "#/definitions/AddressInput" - }, - { - "type": "string" - } - ] - }, - "name": { - "type": "string" - }, - "noticeDate": { - "$ref": "#/definitions/Date" - } - }, - "required": [ - "name", - "address" - ], - "type": "object" - }, - "type": "array" - } - }, - "required": [ - "certificate" - ], - "type": "object" + "$ref": "#/definitions/Ownership" }, "siteContact": { "$ref": "#/definitions/SiteContact" @@ -1965,7 +1876,9 @@ "type": "object" }, "LondonDetails": { + "$id": "#LondonDetails", "additionalProperties": false, + "description": "Proposal details for project sites within the Greater London Authority (GLA) area", "properties": { "extend": { "additionalProperties": false, @@ -2605,7 +2518,7 @@ "LondonProperty": { "$id": "#LondonProperty", "additionalProperties": false, - "description": "Property details for sites within London", + "description": "Property details for sites within the Greater London Authority (GLA) area", "properties": { "EPC": { "additionalProperties": false, @@ -2676,6 +2589,7 @@ "type": "array" }, "region": { + "const": "London", "type": "string" }, "titleNumber": { @@ -2952,6 +2866,58 @@ ], "type": "object" }, + "Ownership": { + "$id": "#Ownership", + "additionalProperties": false, + "description": "Information about the ownership certificate and owners, if different than the applicant", + "properties": { + "certificate": { + "enum": [ + "a", + "b", + "c", + "d" + ], + "type": "string" + }, + "noticeGiven": { + "type": "boolean" + }, + "owners": { + "items": { + "additionalProperties": false, + "properties": { + "address": { + "anyOf": [ + { + "$ref": "#/definitions/AddressInput" + }, + { + "type": "string" + } + ] + }, + "name": { + "type": "string" + }, + "noticeDate": { + "$ref": "#/definitions/Date" + } + }, + "required": [ + "name", + "address" + ], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "certificate" + ], + "type": "object" + }, "PlanningConstraint": { "$id": "#PlanningConstraint", "anyOf": [ @@ -17193,16 +17159,7 @@ "type": "object" }, "date": { - "additionalProperties": false, - "properties": { - "completion": { - "$ref": "#/definitions/Date" - }, - "start": { - "$ref": "#/definitions/Date" - } - }, - "type": "object" + "$ref": "#/definitions/ProposalDates" }, "description": { "type": "string" @@ -17223,6 +17180,20 @@ ], "type": "object" }, + "ProposalDates": { + "$id": "#ProposalDates", + "additionalProperties": false, + "description": "When the proposed works will start and be completed by, not required for all application types", + "properties": { + "completion": { + "$ref": "#/definitions/Date" + }, + "start": { + "$ref": "#/definitions/Date" + } + }, + "type": "object" + }, "ProposalDetails": { "$id": "#ProposalDetails", "anyOf": [ diff --git a/types/enums/PropertyTypes.ts b/types/enums/PropertyTypes.ts index b3169405..037757d4 100644 --- a/types/enums/PropertyTypes.ts +++ b/types/enums/PropertyTypes.ts @@ -1,5 +1,5 @@ /** - * Values of `data.property.type` + * Values of `data.property.type`, derived from Basic Land and Property Unit (BLPU) classification codes */ export const PropertyTypes = { commercial: 'Commercial', diff --git a/types/schema/data/Applicant.ts b/types/schema/data/Applicant.ts index bbb81d0c..5e8477ad 100644 --- a/types/schema/data/Applicant.ts +++ b/types/schema/data/Applicant.ts @@ -14,20 +14,26 @@ export type Applicant = BaseApplicant | Agent; export interface BaseApplicant { type: 'individual' | 'company' | 'charity' | 'public' | 'parishCouncil'; interest?: 'owner.sole' | 'owner.co' | 'tenant' | 'occupier' | 'other'; - ownership?: { - certificate: 'a' | 'b' | 'c' | 'd'; - noticeGiven?: boolean; - owners?: { - name: string; - address: AddressInput | string; - noticeDate?: Date; - }[]; - }; + ownership?: Ownership; contact: UserContact; address: UserAddress; siteContact: SiteContact; } +/** + * @id #Ownership + * @description Information about the ownership certificate and owners, if different than the applicant + */ +export interface Ownership { + certificate: 'a' | 'b' | 'c' | 'd'; + noticeGiven?: boolean; + owners?: { + name: string; + address: AddressInput | string; + noticeDate?: Date; + }[]; +} + /** * @id #Agent * @description Information about the user who completed the application on behalf of someone else diff --git a/types/schema/data/Application.ts b/types/schema/data/Application.ts index f7a4aa9c..6e6b1648 100644 --- a/types/schema/data/Application.ts +++ b/types/schema/data/Application.ts @@ -8,18 +8,7 @@ import {Date} from '../../utils'; export interface Application { type: ApplicationType; fee: ApplicationFee; - declaration: { - accurate: boolean; - connection: { - value: - | 'employee' - | 'relation.employee' - | 'electedMember' - | 'relation.electedMember' - | 'none'; - description?: string; - }; - }; + declaration: ApplicationDeclaration; preApp?: PreApplication; } @@ -45,6 +34,23 @@ export interface ApplicationFee { }; } +/** + * @id #ApplicationDeclaration + * @description Declarations about the accuracy of this application and any personal connections to the receiving authority + */ +export interface ApplicationDeclaration { + accurate: boolean; + connection: { + value: + | 'employee' + | 'relation.employee' + | 'electedMember' + | 'relation.electedMember' + | 'none'; + description?: string; + }; +} + /** * @id #PreApplication * @description Details of the pre-application, if applicable diff --git a/types/schema/data/Property.ts b/types/schema/data/Property.ts index 483183fb..dbf1ac7d 100644 --- a/types/schema/data/Property.ts +++ b/types/schema/data/Property.ts @@ -29,9 +29,10 @@ export interface UKProperty { /** * @id #LondonProperty - * @description Property details for sites within London + * @description Property details for sites within the Greater London Authority (GLA) area */ export interface LondonProperty extends UKProperty { + region: 'London'; titleNumber: { known: 'Yes' | 'No'; number?: string; diff --git a/types/schema/data/Proposal.ts b/types/schema/data/Proposal.ts index 38a42031..77a0caeb 100644 --- a/types/schema/data/Proposal.ts +++ b/types/schema/data/Proposal.ts @@ -14,13 +14,19 @@ export interface Proposal { site: GeoJSON; area: Area; }; - date?: { - start?: Date; - completion?: Date; - }; + date?: ProposalDates; details?: ProposalDetails; } +/** + * @id #ProposalDates + * @description When the proposed works will start and be completed by, not required for all application types + */ +export interface ProposalDates { + start?: Date; + completion?: Date; +} + /** * @id #ProposalDetails * @description Details about the changes being proposed @@ -41,6 +47,10 @@ export interface BaseDetails { }; } +/** + * @id #LondonDetails + * @description Proposal details for project sites within the Greater London Authority (GLA) area + */ export interface LondonDetails extends BaseDetails { vehicleParking: { type: VehicleParking[]; From efd0cbb6f3768583bdf29c6023054b6ddbb69bf8 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 25 Oct 2023 12:27:46 +0200 Subject: [PATCH 4/5] update region enum --- schema/schema.json | 18 +++++++++++++++++- types/schema/data/Property.ts | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/schema/schema.json b/schema/schema.json index 6eceaf1e..23e60dcc 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -18008,7 +18008,7 @@ "type": "array" }, "region": { - "type": "string" + "$ref": "#/definitions/UKRegion" }, "type": { "$ref": "#/definitions/PropertyType" @@ -18022,6 +18022,22 @@ ], "type": "object" }, + "UKRegion": { + "$id": "#UKRegion", + "description": "UK regions sourced from planning.data.gov.uk/dataset/region, where \"London\" is a proxy for the Greater London Authority (GLA) area", + "enum": [ + "North East", + "North West", + "Yorkshire and The Humber", + "East Midlands", + "West Midlands", + "East of England", + "London", + "South East", + "South West" + ], + "type": "string" + }, "URL": { "format": "uri", "pattern": "^https?://", diff --git a/types/schema/data/Property.ts b/types/schema/data/Property.ts index dbf1ac7d..babe4f92 100644 --- a/types/schema/data/Property.ts +++ b/types/schema/data/Property.ts @@ -9,13 +9,28 @@ import {Area, URL} from '../../utils'; */ export type Property = UKProperty | LondonProperty; +/** + * @id #UKRegion + * @description UK regions sourced from planning.data.gov.uk/dataset/region, where "London" is a proxy for the Greater London Authority (GLA) area + */ +export type UKRegion = + | 'North East' + | 'North West' + | 'Yorkshire and The Humber' + | 'East Midlands' + | 'West Midlands' + | 'East of England' + | 'London' + | 'South East' + | 'South West'; + /** * @id #UKProperty * @description Property details for sites anywhere in the UK */ export interface UKProperty { address: ProposedAddress | OSAddress; - region: string; + region: UKRegion; localAuthorityDistrict: string[]; type: PropertyType; boundary?: { @@ -32,7 +47,7 @@ export interface UKProperty { * @description Property details for sites within the Greater London Authority (GLA) area */ export interface LondonProperty extends UKProperty { - region: 'London'; + region: Extract; titleNumber: { known: 'Yes' | 'No'; number?: string; From 468cae03b356129cb5f2d4111e00ceb1efeedece Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 25 Oct 2023 12:33:53 +0200 Subject: [PATCH 5/5] avoid quotes in descriptions --- schema/schema.json | 2 +- types/schema/data/Property.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/schema.json b/schema/schema.json index 23e60dcc..5039eb3d 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -18024,7 +18024,7 @@ }, "UKRegion": { "$id": "#UKRegion", - "description": "UK regions sourced from planning.data.gov.uk/dataset/region, where \"London\" is a proxy for the Greater London Authority (GLA) area", + "description": "UK regions sourced from planning.data.gov.uk/dataset/region, where London is a proxy for the Greater London Authority (GLA) area", "enum": [ "North East", "North West", diff --git a/types/schema/data/Property.ts b/types/schema/data/Property.ts index babe4f92..132a558e 100644 --- a/types/schema/data/Property.ts +++ b/types/schema/data/Property.ts @@ -11,7 +11,7 @@ export type Property = UKProperty | LondonProperty; /** * @id #UKRegion - * @description UK regions sourced from planning.data.gov.uk/dataset/region, where "London" is a proxy for the Greater London Authority (GLA) area + * @description UK regions sourced from planning.data.gov.uk/dataset/region, where London is a proxy for the Greater London Authority (GLA) area */ export type UKRegion = | 'North East'