You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ x] I have read the FAQ and my issue was not answered there
What version of Zog are you using
0.17
Describe the bug
A clear and concise description of what the bug is.
The Required check fails on empty string values, even if they are present.
To Reproduce
A small, self-container, complete reproduction, uploaded to a Github repo, containing the minimum amount of files required to reproduce the behaviour, along with a list of commands that need to be run. Keep it simple.
Expected behavior
A clear and concise description of what you expected to happen.
I expect the Required check to pass, since they key is present and it is a string.
I further expect I can manage the length with the Min check, which is more intuitive.
This is important for error reporting, since the required check fails with the error "is required".
It doesn't really matter where I add Min:
If I add it after (Required().Min()) the check will fail on the empty string
If I add it before (Min().Required()) the min check passes (presumably because the value isn't required at that point, so min does not feel it needs to be enforced?) This is especially counterintuitive.
The text was updated successfully, but these errors were encountered:
You might be right to think that this is bad behavior. Zod works how you describe. I'll need to think about it. Because for Validate it should still create an error as we don't know if an empty string was provided or if the user didn't specify anything
Before you begin
What version of Zog are you using
0.17
Describe the bug
A clear and concise description of what the bug is.
The
Required
check fails on empty string values, even if they are present.To Reproduce
A small, self-container, complete reproduction, uploaded to a Github repo, containing the minimum amount of files required to reproduce the behaviour, along with a list of commands that need to be run. Keep it simple.
Expected behavior
A clear and concise description of what you expected to happen.
I expect the
Required
check to pass, since they key is present and it is a string.I further expect I can manage the length with the
Min
check, which is more intuitive.This is important for error reporting, since the required check fails with the error "is required".
It doesn't really matter where I add
Min
:Required().Min()
) the check will fail on the empty stringMin().Required()
) the min check passes (presumably because the value isn't required at that point, so min does not feel it needs to be enforced?) This is especially counterintuitive.The text was updated successfully, but these errors were encountered: