From 41cdc4b521c504cb639740587bfa50592727b644 Mon Sep 17 00:00:00 2001 From: Mingbo Peng Date: Tue, 10 Sep 2024 18:14:05 -0400 Subject: [PATCH] fix(Ts): regenerate Ts --- .generator | 2 +- src/DragonflySchema/DragonflySchema.csproj | 2 +- src/TypeScriptSDK/models/Building.ts | 2 +- .../models/BuildingEnergyPropertiesAbridged.ts | 2 +- .../models/BuildingPropertiesAbridged.ts | 2 +- .../BuildingRadiancePropertiesAbridged.ts | 2 +- src/TypeScriptSDK/models/ContextShade.ts | 2 +- .../ContextShadeEnergyPropertiesAbridged.ts | 2 +- .../models/ContextShadePropertiesAbridged.ts | 2 +- .../ContextShadeRadiancePropertiesAbridged.ts | 2 +- src/TypeScriptSDK/models/DetailedSkylights.ts | 13 ++++--------- src/TypeScriptSDK/models/DetailedWindows.ts | 13 ++++--------- .../models/ExteriorApertureGridParameter.ts | 2 +- .../models/ExteriorFaceGridParameter.ts | 2 +- src/TypeScriptSDK/models/ExtrudedBorder.ts | 2 +- .../models/GriddedSkylightArea.ts | 2 +- .../models/GriddedSkylightRatio.ts | 2 +- src/TypeScriptSDK/models/LouversByCount.ts | 2 +- src/TypeScriptSDK/models/LouversByDistance.ts | 2 +- src/TypeScriptSDK/models/Model.ts | 2 +- .../models/ModelEnergyProperties.ts | 2 +- src/TypeScriptSDK/models/ModelProperties.ts | 2 +- .../models/ModelRadianceProperties.ts | 2 +- src/TypeScriptSDK/models/Overhang.ts | 2 +- src/TypeScriptSDK/models/RectangularWindows.ts | 10 ++++------ .../models/RepeatingWindowRatio.ts | 2 +- src/TypeScriptSDK/models/RoofSpecification.ts | 2 +- src/TypeScriptSDK/models/Room2D.ts | 18 +++++------------- .../models/Room2DEnergyPropertiesAbridged.ts | 2 +- .../models/Room2DPropertiesAbridged.ts | 2 +- .../models/Room2DRadiancePropertiesAbridged.ts | 2 +- src/TypeScriptSDK/models/RoomGridParameter.ts | 2 +- .../models/RoomRadialGridParameter.ts | 2 +- src/TypeScriptSDK/models/SimpleWindowArea.ts | 2 +- src/TypeScriptSDK/models/SimpleWindowRatio.ts | 2 +- src/TypeScriptSDK/models/SingleWindow.ts | 2 +- src/TypeScriptSDK/models/Story.ts | 2 +- .../models/StoryEnergyPropertiesAbridged.ts | 2 +- .../models/StoryPropertiesAbridged.ts | 2 +- .../models/StoryRadiancePropertiesAbridged.ts | 2 +- src/TypeScriptSDK/models/_GridParameterBase.ts | 2 +- src/TypeScriptSDK/models/_LouversBase.ts | 2 +- .../models/_WindowParameterBase.ts | 2 +- src/TypeScriptSDK/package.json | 2 +- src/TypeScriptSDK/tsconfig.json | 2 +- 45 files changed, 58 insertions(+), 78 deletions(-) diff --git a/.generator b/.generator index 67d669b..d8fbab3 160000 --- a/.generator +++ b/.generator @@ -1 +1 @@ -Subproject commit 67d669b346458bafb515fb48a8128a26953e4d2c +Subproject commit d8fbab3cfbd97b4c7af14526928090f6399fc8e9 diff --git a/src/DragonflySchema/DragonflySchema.csproj b/src/DragonflySchema/DragonflySchema.csproj index b1f5b3f..b4ee035 100644 --- a/src/DragonflySchema/DragonflySchema.csproj +++ b/src/DragonflySchema/DragonflySchema.csproj @@ -3,7 +3,7 @@ netstandard2.0;net452 true - 1.12.1-v6 + 1.12.1-v8 Ladybug Tools This is the .Net version of Dragonfly Schema Copyright © 2024 Ladybug Tools LLC diff --git a/src/TypeScriptSDK/models/Building.ts b/src/TypeScriptSDK/models/Building.ts index e36732d..1087ee3 100644 --- a/src/TypeScriptSDK/models/Building.ts +++ b/src/TypeScriptSDK/models/Building.ts @@ -90,7 +90,7 @@ export class Building extends IDdBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/BuildingEnergyPropertiesAbridged.ts b/src/TypeScriptSDK/models/BuildingEnergyPropertiesAbridged.ts index 94cef67..917ccf7 100644 --- a/src/TypeScriptSDK/models/BuildingEnergyPropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/BuildingEnergyPropertiesAbridged.ts @@ -57,7 +57,7 @@ export class BuildingEnergyPropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/BuildingPropertiesAbridged.ts b/src/TypeScriptSDK/models/BuildingPropertiesAbridged.ts index e10be60..8355444 100644 --- a/src/TypeScriptSDK/models/BuildingPropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/BuildingPropertiesAbridged.ts @@ -65,7 +65,7 @@ export class BuildingPropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/BuildingRadiancePropertiesAbridged.ts b/src/TypeScriptSDK/models/BuildingRadiancePropertiesAbridged.ts index e311eae..fc8269f 100644 --- a/src/TypeScriptSDK/models/BuildingRadiancePropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/BuildingRadiancePropertiesAbridged.ts @@ -55,7 +55,7 @@ export class BuildingRadiancePropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ContextShade.ts b/src/TypeScriptSDK/models/ContextShade.ts index 6fb3084..3923f3c 100644 --- a/src/TypeScriptSDK/models/ContextShade.ts +++ b/src/TypeScriptSDK/models/ContextShade.ts @@ -75,7 +75,7 @@ export class ContextShade extends IDdBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ContextShadeEnergyPropertiesAbridged.ts b/src/TypeScriptSDK/models/ContextShadeEnergyPropertiesAbridged.ts index 2cec525..46d302d 100644 --- a/src/TypeScriptSDK/models/ContextShadeEnergyPropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/ContextShadeEnergyPropertiesAbridged.ts @@ -66,7 +66,7 @@ export class ContextShadeEnergyPropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ContextShadePropertiesAbridged.ts b/src/TypeScriptSDK/models/ContextShadePropertiesAbridged.ts index c688940..1fb6bb6 100644 --- a/src/TypeScriptSDK/models/ContextShadePropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/ContextShadePropertiesAbridged.ts @@ -65,7 +65,7 @@ export class ContextShadePropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ContextShadeRadiancePropertiesAbridged.ts b/src/TypeScriptSDK/models/ContextShadeRadiancePropertiesAbridged.ts index ab847ec..0bfa686 100644 --- a/src/TypeScriptSDK/models/ContextShadeRadiancePropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/ContextShadeRadiancePropertiesAbridged.ts @@ -55,7 +55,7 @@ export class ContextShadeRadiancePropertiesAbridged extends _OpenAPIGenBaseModel async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/DetailedSkylights.ts b/src/TypeScriptSDK/models/DetailedSkylights.ts index 224216d..bb7e426 100644 --- a/src/TypeScriptSDK/models/DetailedSkylights.ts +++ b/src/TypeScriptSDK/models/DetailedSkylights.ts @@ -1,17 +1,12 @@ -import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator'; +import { IsArray, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator'; import { Type, plainToClass } from 'class-transformer'; +import { IsNestedNumberArray } from "./../helpers/class-validator"; import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel"; /** Several detailed skylights defined by 2D Polygons (lists of 2D vertices). */ export class DetailedSkylights extends _OpenAPIGenBaseModel { @IsArray() - @IsArray({ each: true }) - @ValidateNested({each: true }) - @Type(() => Array) - @IsArray({ each: true }) - @ValidateNested({each: true }) - @Type(() => Array) - @IsNumber({},{ each: true }) + @IsNestedNumberArray() @IsDefined() /** An array of arrays with each sub-array representing a polygonal boundary of a skylight. Each sub-array should consist of arrays representing points, which contain 2 values for 2D coordinates in the world XY system. These coordinate values should lie within the parent Room2D Polygon. */ polygons!: number [] [] []; @@ -70,7 +65,7 @@ export class DetailedSkylights extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/DetailedWindows.ts b/src/TypeScriptSDK/models/DetailedWindows.ts index 6a300e8..b48f70b 100644 --- a/src/TypeScriptSDK/models/DetailedWindows.ts +++ b/src/TypeScriptSDK/models/DetailedWindows.ts @@ -1,17 +1,12 @@ -import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator'; +import { IsArray, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator'; import { Type, plainToClass } from 'class-transformer'; +import { IsNestedNumberArray } from "./../helpers/class-validator"; import { _WindowParameterBase } from "./_WindowParameterBase"; /** Several detailed windows defined by 2D Polygons (lists of 2D vertices). */ export class DetailedWindows extends _WindowParameterBase { @IsArray() - @IsArray({ each: true }) - @ValidateNested({each: true }) - @Type(() => Array) - @IsArray({ each: true }) - @ValidateNested({each: true }) - @Type(() => Array) - @IsNumber({},{ each: true }) + @IsNestedNumberArray() @IsDefined() /** An array of arrays with each sub-array representing a polygonal boundary of a window. Each sub-array should consist of arrays representing points, which can either contain 2 values (indicating they are 2D vertices within the plane of a parent wall segment) or they can contain 3 values (indicating they are 3D world coordinates). For 2D points, the wall plane is assumed to have an origin at the first point of the wall segment and an X-axis extending along the length of the segment. The wall plane Y-axis always points upwards. Therefore, both X and Y values of each point in the polygon should always be positive. Some sample code to convert from 2D vertices to 2D vertices in the plane of the wall can be found here: https://www.ladybug.tools/dragonfly-core/docs/dragonfly.windowparameter.html#dragonfly.windowparameter.DetailedWindows */ polygons!: number [] [] []; @@ -70,7 +65,7 @@ export class DetailedWindows extends _WindowParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ExteriorApertureGridParameter.ts b/src/TypeScriptSDK/models/ExteriorApertureGridParameter.ts index 5708b67..c3ad186 100644 --- a/src/TypeScriptSDK/models/ExteriorApertureGridParameter.ts +++ b/src/TypeScriptSDK/models/ExteriorApertureGridParameter.ts @@ -66,7 +66,7 @@ export class ExteriorApertureGridParameter extends _GridParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ExteriorFaceGridParameter.ts b/src/TypeScriptSDK/models/ExteriorFaceGridParameter.ts index 9410c93..cc2fbf1 100644 --- a/src/TypeScriptSDK/models/ExteriorFaceGridParameter.ts +++ b/src/TypeScriptSDK/models/ExteriorFaceGridParameter.ts @@ -74,7 +74,7 @@ export class ExteriorFaceGridParameter extends _GridParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ExtrudedBorder.ts b/src/TypeScriptSDK/models/ExtrudedBorder.ts index 6e94c00..5aa42cc 100644 --- a/src/TypeScriptSDK/models/ExtrudedBorder.ts +++ b/src/TypeScriptSDK/models/ExtrudedBorder.ts @@ -55,7 +55,7 @@ export class ExtrudedBorder extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/GriddedSkylightArea.ts b/src/TypeScriptSDK/models/GriddedSkylightArea.ts index 01a9ce8..3510e51 100644 --- a/src/TypeScriptSDK/models/GriddedSkylightArea.ts +++ b/src/TypeScriptSDK/models/GriddedSkylightArea.ts @@ -63,7 +63,7 @@ export class GriddedSkylightArea extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/GriddedSkylightRatio.ts b/src/TypeScriptSDK/models/GriddedSkylightRatio.ts index bbeb0b1..77ced12 100644 --- a/src/TypeScriptSDK/models/GriddedSkylightRatio.ts +++ b/src/TypeScriptSDK/models/GriddedSkylightRatio.ts @@ -63,7 +63,7 @@ export class GriddedSkylightRatio extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/LouversByCount.ts b/src/TypeScriptSDK/models/LouversByCount.ts index 711afed..ada0ac5 100644 --- a/src/TypeScriptSDK/models/LouversByCount.ts +++ b/src/TypeScriptSDK/models/LouversByCount.ts @@ -55,7 +55,7 @@ export class LouversByCount extends _LouversBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/LouversByDistance.ts b/src/TypeScriptSDK/models/LouversByDistance.ts index 0373b5f..88c36c7 100644 --- a/src/TypeScriptSDK/models/LouversByDistance.ts +++ b/src/TypeScriptSDK/models/LouversByDistance.ts @@ -55,7 +55,7 @@ export class LouversByDistance extends _LouversBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/Model.ts b/src/TypeScriptSDK/models/Model.ts index f40ab52..54bacd4 100644 --- a/src/TypeScriptSDK/models/Model.ts +++ b/src/TypeScriptSDK/models/Model.ts @@ -117,7 +117,7 @@ export class Model extends IDdBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ModelEnergyProperties.ts b/src/TypeScriptSDK/models/ModelEnergyProperties.ts index 19be49f..d032798 100644 --- a/src/TypeScriptSDK/models/ModelEnergyProperties.ts +++ b/src/TypeScriptSDK/models/ModelEnergyProperties.ts @@ -598,7 +598,7 @@ export class ModelEnergyProperties extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ModelProperties.ts b/src/TypeScriptSDK/models/ModelProperties.ts index 833ad79..6f1cc64 100644 --- a/src/TypeScriptSDK/models/ModelProperties.ts +++ b/src/TypeScriptSDK/models/ModelProperties.ts @@ -65,7 +65,7 @@ export class ModelProperties extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/ModelRadianceProperties.ts b/src/TypeScriptSDK/models/ModelRadianceProperties.ts index 5ada99b..1a23b71 100644 --- a/src/TypeScriptSDK/models/ModelRadianceProperties.ts +++ b/src/TypeScriptSDK/models/ModelRadianceProperties.ts @@ -245,7 +245,7 @@ export class ModelRadianceProperties extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/Overhang.ts b/src/TypeScriptSDK/models/Overhang.ts index 1f329ce..44e031b 100644 --- a/src/TypeScriptSDK/models/Overhang.ts +++ b/src/TypeScriptSDK/models/Overhang.ts @@ -65,7 +65,7 @@ export class Overhang extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/RectangularWindows.ts b/src/TypeScriptSDK/models/RectangularWindows.ts index 9e24949..3d18811 100644 --- a/src/TypeScriptSDK/models/RectangularWindows.ts +++ b/src/TypeScriptSDK/models/RectangularWindows.ts @@ -1,14 +1,12 @@ -import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator'; +import { IsArray, IsDefined, IsNumber, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator'; import { Type, plainToClass } from 'class-transformer'; +import { IsNestedNumberArray } from "./../helpers/class-validator"; import { _WindowParameterBase } from "./_WindowParameterBase"; /** Several rectangular windows, defined by origin, width and height. */ export class RectangularWindows extends _WindowParameterBase { @IsArray() - @IsArray({ each: true }) - @ValidateNested({each: true }) - @Type(() => Array) - @IsNumber({},{ each: true }) + @IsNestedNumberArray() @IsDefined() /** An array of 2D points within the plane of the wall for the origin of each window. Each point should be a list of 2 (x, y) values. The wall plane is assumed to have an origin at the first point of the wall segment and an X-axis extending along the length of the segment. The wall plane Y-axis always points upwards. Therefore, both X and Y values of each origin point should be positive. */ origins!: number [] []; @@ -83,7 +81,7 @@ export class RectangularWindows extends _WindowParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/RepeatingWindowRatio.ts b/src/TypeScriptSDK/models/RepeatingWindowRatio.ts index 5f349b6..503979a 100644 --- a/src/TypeScriptSDK/models/RepeatingWindowRatio.ts +++ b/src/TypeScriptSDK/models/RepeatingWindowRatio.ts @@ -86,7 +86,7 @@ export class RepeatingWindowRatio extends _WindowParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/RoofSpecification.ts b/src/TypeScriptSDK/models/RoofSpecification.ts index 5f1b8f7..4018027 100644 --- a/src/TypeScriptSDK/models/RoofSpecification.ts +++ b/src/TypeScriptSDK/models/RoofSpecification.ts @@ -59,7 +59,7 @@ export class RoofSpecification extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/Room2D.ts b/src/TypeScriptSDK/models/Room2D.ts index b0ad867..7ef0ece 100644 --- a/src/TypeScriptSDK/models/Room2D.ts +++ b/src/TypeScriptSDK/models/Room2D.ts @@ -1,5 +1,6 @@ -import { IsArray, ValidateNested, IsNumber, IsDefined, IsInstance, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator'; +import { IsArray, IsDefined, IsNumber, IsInstance, ValidateNested, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator'; import { Type, plainToClass } from 'class-transformer'; +import { IsNestedNumberArray } from "./../helpers/class-validator"; import { Adiabatic } from "honeybee-schema"; import { DetailedSkylights } from "./DetailedSkylights"; import { DetailedWindows } from "./DetailedWindows"; @@ -24,10 +25,7 @@ import { Surface } from "honeybee-schema"; /** Base class for all objects requiring a identifiers acceptable for all engines. */ export class Room2D extends IDdBaseModel { @IsArray() - @IsArray({ each: true }) - @ValidateNested({each: true }) - @Type(() => Array) - @IsNumber({},{ each: true }) + @IsNestedNumberArray() @IsDefined() /** A list of 2D points representing the outer boundary vertices of the Room2D. The list should include at least 3 points and each point should be a list of 2 (x, y) values. */ floor_boundary!: number [] []; @@ -55,13 +53,7 @@ export class Room2D extends IDdBaseModel { type?: string; @IsArray() - @IsArray({ each: true }) - @ValidateNested({each: true }) - @Type(() => Array) - @IsArray({ each: true }) - @ValidateNested({each: true }) - @Type(() => Array) - @IsNumber({},{ each: true }) + @IsNestedNumberArray() @IsOptional() /** Optional list of lists with one list for each hole in the floor plate. Each hole should be a list of at least 2 points and each point a list of 2 (x, y) values. If None, it will be assumed that there are no holes in the floor plate. */ floor_holes?: number [] [] []; @@ -166,7 +158,7 @@ export class Room2D extends IDdBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/Room2DEnergyPropertiesAbridged.ts b/src/TypeScriptSDK/models/Room2DEnergyPropertiesAbridged.ts index 05969b2..ae10567 100644 --- a/src/TypeScriptSDK/models/Room2DEnergyPropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/Room2DEnergyPropertiesAbridged.ts @@ -115,7 +115,7 @@ export class Room2DEnergyPropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/Room2DPropertiesAbridged.ts b/src/TypeScriptSDK/models/Room2DPropertiesAbridged.ts index c84b42e..4d1c291 100644 --- a/src/TypeScriptSDK/models/Room2DPropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/Room2DPropertiesAbridged.ts @@ -65,7 +65,7 @@ export class Room2DPropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/Room2DRadiancePropertiesAbridged.ts b/src/TypeScriptSDK/models/Room2DRadiancePropertiesAbridged.ts index 2a3c4ea..5577053 100644 --- a/src/TypeScriptSDK/models/Room2DRadiancePropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/Room2DRadiancePropertiesAbridged.ts @@ -66,7 +66,7 @@ export class Room2DRadiancePropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/RoomGridParameter.ts b/src/TypeScriptSDK/models/RoomGridParameter.ts index cfd8ccc..bc14bd3 100644 --- a/src/TypeScriptSDK/models/RoomGridParameter.ts +++ b/src/TypeScriptSDK/models/RoomGridParameter.ts @@ -64,7 +64,7 @@ export class RoomGridParameter extends _GridParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/RoomRadialGridParameter.ts b/src/TypeScriptSDK/models/RoomRadialGridParameter.ts index 286a60b..3efa7e3 100644 --- a/src/TypeScriptSDK/models/RoomRadialGridParameter.ts +++ b/src/TypeScriptSDK/models/RoomRadialGridParameter.ts @@ -72,7 +72,7 @@ export class RoomRadialGridParameter extends RoomGridParameter { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/SimpleWindowArea.ts b/src/TypeScriptSDK/models/SimpleWindowArea.ts index 8a2477e..26456dc 100644 --- a/src/TypeScriptSDK/models/SimpleWindowArea.ts +++ b/src/TypeScriptSDK/models/SimpleWindowArea.ts @@ -63,7 +63,7 @@ export class SimpleWindowArea extends _WindowParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/SimpleWindowRatio.ts b/src/TypeScriptSDK/models/SimpleWindowRatio.ts index 75062bd..4ca3042 100644 --- a/src/TypeScriptSDK/models/SimpleWindowRatio.ts +++ b/src/TypeScriptSDK/models/SimpleWindowRatio.ts @@ -63,7 +63,7 @@ export class SimpleWindowRatio extends _WindowParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/SingleWindow.ts b/src/TypeScriptSDK/models/SingleWindow.ts index b527bc2..1456fc2 100644 --- a/src/TypeScriptSDK/models/SingleWindow.ts +++ b/src/TypeScriptSDK/models/SingleWindow.ts @@ -70,7 +70,7 @@ export class SingleWindow extends _WindowParameterBase { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/Story.ts b/src/TypeScriptSDK/models/Story.ts index b3ad1ed..0d1bc32 100644 --- a/src/TypeScriptSDK/models/Story.ts +++ b/src/TypeScriptSDK/models/Story.ts @@ -103,7 +103,7 @@ export class Story extends IDdBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/StoryEnergyPropertiesAbridged.ts b/src/TypeScriptSDK/models/StoryEnergyPropertiesAbridged.ts index cf259ad..e14be9c 100644 --- a/src/TypeScriptSDK/models/StoryEnergyPropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/StoryEnergyPropertiesAbridged.ts @@ -57,7 +57,7 @@ export class StoryEnergyPropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/StoryPropertiesAbridged.ts b/src/TypeScriptSDK/models/StoryPropertiesAbridged.ts index ac43516..3091d44 100644 --- a/src/TypeScriptSDK/models/StoryPropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/StoryPropertiesAbridged.ts @@ -65,7 +65,7 @@ export class StoryPropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/StoryRadiancePropertiesAbridged.ts b/src/TypeScriptSDK/models/StoryRadiancePropertiesAbridged.ts index 746fbfd..58181c0 100644 --- a/src/TypeScriptSDK/models/StoryRadiancePropertiesAbridged.ts +++ b/src/TypeScriptSDK/models/StoryRadiancePropertiesAbridged.ts @@ -55,7 +55,7 @@ export class StoryRadiancePropertiesAbridged extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/_GridParameterBase.ts b/src/TypeScriptSDK/models/_GridParameterBase.ts index c4596b9..513445f 100644 --- a/src/TypeScriptSDK/models/_GridParameterBase.ts +++ b/src/TypeScriptSDK/models/_GridParameterBase.ts @@ -63,7 +63,7 @@ export class _GridParameterBase extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/_LouversBase.ts b/src/TypeScriptSDK/models/_LouversBase.ts index ec291dc..4406192 100644 --- a/src/TypeScriptSDK/models/_LouversBase.ts +++ b/src/TypeScriptSDK/models/_LouversBase.ts @@ -91,7 +91,7 @@ export class _LouversBase extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/models/_WindowParameterBase.ts b/src/TypeScriptSDK/models/_WindowParameterBase.ts index 6fddc70..1c030f1 100644 --- a/src/TypeScriptSDK/models/_WindowParameterBase.ts +++ b/src/TypeScriptSDK/models/_WindowParameterBase.ts @@ -54,7 +54,7 @@ export class _WindowParameterBase extends _OpenAPIGenBaseModel { async validate(): Promise { const errors = await validate(this); if (errors.length > 0){ - const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error.property]).join(', ')).join('; '); + const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; '); throw new Error(`Validation failed: ${errorMessages}`); } return true; diff --git a/src/TypeScriptSDK/package.json b/src/TypeScriptSDK/package.json index 497252b..0e649ae 100644 --- a/src/TypeScriptSDK/package.json +++ b/src/TypeScriptSDK/package.json @@ -1,7 +1,7 @@ { "name": "dragonfly-schema", "license": "MIT", - "version": "1.12.1-v6", + "version": "1.12.1-v8", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/src/TypeScriptSDK/tsconfig.json b/src/TypeScriptSDK/tsconfig.json index e9174ec..b50036b 100644 --- a/src/TypeScriptSDK/tsconfig.json +++ b/src/TypeScriptSDK/tsconfig.json @@ -27,6 +27,6 @@ "noFallthroughCasesInSwitch": true }, - "include": [ "models"], + "include": [ "models", "helpers"], "exclude": ["node_modules"] }