MichalLytek / MichalLytek/class-transformer-validator
add support for validating boolean values
- Dominant language
- TypeScript
- Stars
- 205
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing transformAndValidate and transformValidationOption when enableImplicitConversion is enabled. Reproduce the boolean conversion described in issue #46, then verify that strings other than 'true' or 'false' are not accepted as true while valid boolean values continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100