When validationMetadatasToSchemas fails to generate the spec the thrown error has very little information.
The class causing the error looks like this:
export class AssessmentItemDto {
@IsString()
@MaxLength(100)
key: string;
@IsString()
@MaxLength(50)
label: string;
@IsOptional()
@IsIn([true, false, null])
value: boolean | null;
@IsString()
@MaxLength(100)
remark: string;
}
The error is caused by @IsIn([true, false, null]). The error message is TypeError: undefined is not an object (evaluating 'item.type'). It would be nice if is said something like this:
Failed to generate spec while evaluating:
class: `AssessmentItemDto`,
property: `value`,
decorator:`@IsIn`,
message: `TypeError: undefined is not an object (evaluating 'item.type')`
at: (file name and line number)
When
validationMetadatasToSchemasfails to generate the spec the thrown error has very little information.The class causing the error looks like this:
The error is caused by
@IsIn([true, false, null]). The error message isTypeError: undefined is not an object (evaluating 'item.type'). It would be nice if is said something like this: