-
Notifications
You must be signed in to change notification settings - Fork 822
add support for undefined value in isOptional #102
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
add support for undefined value in isOptional #102
Conversation
@pleerock I was wondering if you would look over this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't undefined
be treated differently as it is not same as empty
string or null
. Suppose if property is of type boolean
it would allow empty
string or null
to bypass the validation, though they are incorrect (say it is being stored in database), I think there should be a new decorator @IsNotRequired()
which explicitly ignores validation if value is only undefined
. Or if you want to follow semantics of Typescript, functionality of @IsOptional()
and @IsNotRequired()
can be switched with above semantics, which would be a breaking change.
As @adnan-kamili said, why does And it would be great if it both Added: Also, I wonder if |
@pleerock allowing null or empty string to bypass in |
@pleerock You merge but never released it to npm. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
fixes #101