MichalLytek / MichalLytek/class-transformer-validator

add support for validating boolean values

Open
#46 0 comments 0 reactions 0 assignees View on GitHub
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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.