Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Ts): regenerate with min/max validation #146

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/Building.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsInstance, ValidateNested, IsDefined, IsString, IsOptional, IsArray, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsInstance, ValidateNested, IsDefined, IsString, IsOptional, Matches, IsArray, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { BuildingPropertiesAbridged } from "./BuildingPropertiesAbridged";
import { IDdBaseModel } from "honeybee-schema";
Expand All @@ -17,6 +17,7 @@ export class Building extends IDdBaseModel {

@IsString()
@IsOptional()
@Matches(/^Building$/)
type?: string;

@IsArray()
Expand Down
5 changes: 4 additions & 1 deletion src/TypeScriptSDK/models/BuildingEnergyPropertiesAbridged.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, MinLength, MaxLength, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";

/** Base class for all objects that are not extensible with additional keys.\n\nThis effectively includes all objects except for the Properties classes\nthat are assigned to geometry objects. */
export class BuildingEnergyPropertiesAbridged extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^BuildingEnergyPropertiesAbridged$/)
type?: string;

@IsString()
@IsOptional()
@MinLength(1)
@MaxLength(100)
/** Name of a ConstructionSet to specify all constructions for the Building. If None, the Model global_construction_set will be used. */
construction_set?: string;

Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/BuildingPropertiesAbridged.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsInstance, ValidateNested, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, IsInstance, ValidateNested, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
import { BuildingEnergyPropertiesAbridged } from "./BuildingEnergyPropertiesAbridged";
Expand All @@ -7,6 +7,7 @@ import { BuildingRadiancePropertiesAbridged } from "./BuildingRadianceProperties
export class BuildingPropertiesAbridged extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^BuildingPropertiesAbridged$/)
type?: string;

@IsInstance(BuildingEnergyPropertiesAbridged)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";

/** Base class for all objects that are not extensible with additional keys.\n\nThis effectively includes all objects except for the Properties classes\nthat are assigned to geometry objects. */
export class BuildingRadiancePropertiesAbridged extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^BuildingRadiancePropertiesAbridged$/)
type?: string;

@IsString()
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/ContextShade.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsArray, IsDefined, IsInstance, ValidateNested, IsString, IsOptional, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsArray, IsDefined, IsInstance, ValidateNested, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { ContextShadePropertiesAbridged } from "./ContextShadePropertiesAbridged";
import { Face3D } from "honeybee-schema";
Expand All @@ -21,6 +21,7 @@ export class ContextShade extends IDdBaseModel {

@IsString()
@IsOptional()
@Matches(/^ContextShade$/)
type?: string;

@IsBoolean()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, MinLength, MaxLength, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";

/** Base class for all objects that are not extensible with additional keys.\n\nThis effectively includes all objects except for the Properties classes\nthat are assigned to geometry objects. */
export class ContextShadeEnergyPropertiesAbridged extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^ContextShadeEnergyPropertiesAbridged$/)
type?: string;

@IsString()
@IsOptional()
@MinLength(1)
@MaxLength(100)
/** Name of a ShadeConstruction to set the reflectance and specularity of the ContextShade. If None, the the EnergyPlus default of 0.2 diffuse reflectance will be used. */
construction?: string;

@IsString()
@IsOptional()
@MinLength(1)
@MaxLength(100)
/** Name of a schedule to set the transmittance of the ContextShade, which can vary throughout the simulation. If None, the ContextShade will be completely opaque. */
transmittance_schedule?: string;

Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/ContextShadePropertiesAbridged.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsInstance, ValidateNested, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, IsInstance, ValidateNested, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
import { ContextShadeEnergyPropertiesAbridged } from "./ContextShadeEnergyPropertiesAbridged";
Expand All @@ -7,6 +7,7 @@ import { ContextShadeRadiancePropertiesAbridged } from "./ContextShadeRadiancePr
export class ContextShadePropertiesAbridged extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^ContextShadePropertiesAbridged$/)
type?: string;

@IsInstance(ContextShadeEnergyPropertiesAbridged)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";

/** Base class for all objects that are not extensible with additional keys.\n\nThis effectively includes all objects except for the Properties classes\nthat are assigned to geometry objects. */
export class ContextShadeRadiancePropertiesAbridged extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^ContextShadeRadiancePropertiesAbridged$/)
type?: string;

@IsString()
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/DetailedSkylights.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";

Expand All @@ -18,6 +18,7 @@ export class DetailedSkylights extends _OpenAPIGenBaseModel {

@IsString()
@IsOptional()
@Matches(/^DetailedSkylights$/)
type?: string;

@IsArray()
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/DetailedWindows.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _WindowParameterBase } from "./_WindowParameterBase";

Expand All @@ -18,6 +18,7 @@ export class DetailedWindows extends _WindowParameterBase {

@IsString()
@IsOptional()
@Matches(/^DetailedWindows$/)
type?: string;

@IsArray()
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/ExteriorApertureGridParameter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsNumber, IsEnum, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, IsNumber, IsEnum, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _GridParameterBase } from "./_GridParameterBase";
import { ExteriorApertureType } from "./ExteriorApertureType";
Expand All @@ -7,6 +7,7 @@ import { ExteriorApertureType } from "./ExteriorApertureType";
export class ExteriorApertureGridParameter extends _GridParameterBase {
@IsString()
@IsOptional()
@Matches(/^ExteriorApertureGridParameter$/)
type?: string;

@IsNumber()
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/ExteriorFaceGridParameter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsNumber, IsEnum, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, IsNumber, IsEnum, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _GridParameterBase } from "./_GridParameterBase";
import { ExteriorFaceType } from "./ExteriorFaceType";
Expand All @@ -7,6 +7,7 @@ import { ExteriorFaceType } from "./ExteriorFaceType";
export class ExteriorFaceGridParameter extends _GridParameterBase {
@IsString()
@IsOptional()
@Matches(/^ExteriorFaceGridParameter$/)
type?: string;

@IsNumber()
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/ExtrudedBorder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNumber, IsDefined, IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsNumber, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";

Expand All @@ -11,6 +11,7 @@ export class ExtrudedBorder extends _OpenAPIGenBaseModel {

@IsString()
@IsOptional()
@Matches(/^ExtrudedBorder$/)
type?: string;


Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/GriddedSkylightArea.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNumber, IsDefined, IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsNumber, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
import { Autocalculate } from "honeybee-schema";
Expand All @@ -12,6 +12,7 @@ export class GriddedSkylightArea extends _OpenAPIGenBaseModel {

@IsString()
@IsOptional()
@Matches(/^GriddedSkylightArea$/)
type?: string;

@IsOptional()
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/GriddedSkylightRatio.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNumber, IsDefined, IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsNumber, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
import { Autocalculate } from "honeybee-schema";
Expand All @@ -12,6 +12,7 @@ export class GriddedSkylightRatio extends _OpenAPIGenBaseModel {

@IsString()
@IsOptional()
@Matches(/^GriddedSkylightRatio$/)
type?: string;

@IsOptional()
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/LouversByCount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsInt, IsDefined, IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsInt, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _LouversBase } from "./_LouversBase";

Expand All @@ -11,6 +11,7 @@ export class LouversByCount extends _LouversBase {

@IsString()
@IsOptional()
@Matches(/^LouversByCount$/)
type?: string;


Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/LouversByDistance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNumber, IsDefined, IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsNumber, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _LouversBase } from "./_LouversBase";

Expand All @@ -11,6 +11,7 @@ export class LouversByDistance extends _LouversBase {

@IsString()
@IsOptional()
@Matches(/^LouversByDistance$/)
type?: string;


Expand Down
6 changes: 5 additions & 1 deletion src/TypeScriptSDK/models/Model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsInstance, ValidateNested, IsDefined, IsString, IsOptional, IsArray, IsEnum, IsNumber, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsInstance, ValidateNested, IsDefined, IsString, IsOptional, Matches, IsArray, IsEnum, IsNumber, Min, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { Building } from "./Building";
import { ContextShade } from "./ContextShade";
Expand All @@ -17,10 +17,12 @@ export class Model extends IDdBaseModel {

@IsString()
@IsOptional()
@Matches(/^Model$/)
type?: string;

@IsString()
@IsOptional()
@Matches(/([0-9]+)\.([0-9]+)\.([0-9]+)/)
/** Text string for the current version of the schema. */
version?: string;

Expand Down Expand Up @@ -48,11 +50,13 @@ export class Model extends IDdBaseModel {

@IsNumber()
@IsOptional()
@Min(0)
/** The maximum difference between x, y, and z values at which vertices are considered equivalent. This value should be in the Model units and is used in a variety of checks and operations. A value of 0 will result in bypassing all checks so it is recommended that this always be a positive number when checks have not already been performed on a Model. The default of 0.01 is suitable for models in meters. */
tolerance?: number;

@IsNumber()
@IsOptional()
@Min(0)
/** The max angle difference in degrees that vertices are allowed to differ from one another in order to consider them colinear. This value is used in a variety of checks and operations that can be performed on geometry. A value of 0 will result in no checks and an inability to perform certain operations so it is recommended that this always be a positive number when checks have not already been performed on a given Model. */
angle_tolerance?: number;

Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/ModelEnergyProperties.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsInstance, ValidateNested, IsArray, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, IsInstance, ValidateNested, IsArray, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
import { AirBoundaryConstruction } from "honeybee-schema";
Expand Down Expand Up @@ -55,6 +55,7 @@ import { WSHPwithDOASAbridged } from "honeybee-schema";
export class ModelEnergyProperties extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^ModelEnergyProperties$/)
type?: string;

@IsInstance(GlobalConstructionSet)
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/ModelProperties.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsInstance, ValidateNested, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, IsInstance, ValidateNested, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
import { ModelEnergyProperties } from "./ModelEnergyProperties";
Expand All @@ -7,6 +7,7 @@ import { ModelRadianceProperties } from "./ModelRadianceProperties";
export class ModelProperties extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^ModelProperties$/)
type?: string;

@IsInstance(ModelEnergyProperties)
Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/ModelRadianceProperties.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsInstance, ValidateNested, IsArray, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsString, IsOptional, Matches, IsInstance, ValidateNested, IsArray, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
import { BSDF } from "honeybee-schema";
Expand All @@ -18,6 +18,7 @@ import { Void } from "honeybee-schema";
export class ModelRadianceProperties extends _OpenAPIGenBaseModel {
@IsString()
@IsOptional()
@Matches(/^ModelRadianceProperties$/)
type?: string;

@IsInstance(GlobalModifierSet)
Expand Down
5 changes: 4 additions & 1 deletion src/TypeScriptSDK/models/Overhang.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNumber, IsDefined, IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsNumber, IsDefined, IsString, IsOptional, Matches, Min, Max, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";

Expand All @@ -11,10 +11,13 @@ export class Overhang extends _OpenAPIGenBaseModel {

@IsString()
@IsOptional()
@Matches(/^Overhang$/)
type?: string;

@IsNumber()
@IsOptional()
@Min(-90)
@Max(90)
/** A number between -90 and 90 for the for an angle to rotate the overhang in degrees. 0 indicates an overhang perpendicular to the wall. Positive values indicate a downward rotation. Negative values indicate an upward rotation. */
angle?: number;

Expand Down
3 changes: 2 additions & 1 deletion src/TypeScriptSDK/models/RectangularWindows.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsArray, ValidateNested, IsNumber, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _WindowParameterBase } from "./_WindowParameterBase";

Expand Down Expand Up @@ -27,6 +27,7 @@ export class RectangularWindows extends _WindowParameterBase {

@IsString()
@IsOptional()
@Matches(/^RectangularWindows$/)
type?: string;

@IsArray()
Expand Down
5 changes: 4 additions & 1 deletion src/TypeScriptSDK/models/RepeatingWindowRatio.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNumber, IsDefined, IsString, IsOptional, validate, ValidationError as TsValidationError } from 'class-validator';
import { IsNumber, IsDefined, Min, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
import { Type, plainToClass } from 'class-transformer';
import { _WindowParameterBase } from "./_WindowParameterBase";

Expand All @@ -21,15 +21,18 @@ export class RepeatingWindowRatio extends _WindowParameterBase {

@IsNumber()
@IsDefined()
@Min(0)
/** A number for the target separation between individual window centerlines. If this number is larger than the parent rectangle base, only one window will be produced. */
horizontal_separation!: number;

@IsString()
@IsOptional()
@Matches(/^RepeatingWindowRatio$/)
type?: string;

@IsNumber()
@IsOptional()
@Min(0)
/** An optional number to create a single vertical separation between top and bottom windows. */
vertical_separation?: number;

Expand Down
Loading