MichalLytek / class-transformer-validator

A simple plugin for class-transformer and class-validator which combines them in a nice and programmer-friendly API.
MIT License
200 stars 20 forks source link

add support for validating boolean values #46

Open muneer-memon opened 2 weeks ago

muneer-memon commented 2 weeks ago

the transformValidationOption allows to convert string to type values using enableImplicitConversion option

const transformedValidatedValues = await transformAndValidate( schema, requestPayload, { transformer: { enableImplicitConversion } } // E.g. string numbers will be converted to type number ); however there is one issue. if your schema specifies one boolean property and the request payload pass any string other than 'true' or 'false' the transformer converts it into true.