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
I'm getting a validation error name is required to not be empty as if I did not specify the the field Name. If I leave out the required validator it works.
So the question is, when exactly to we need to use the required validator?
Because if I don't specify required are we saying that the field is optional? Or does required only work with pointer types?
Can you please explain the use cases and effects of this. I have just discovered that my validation rules were not running before because I made this PR #202 and that is why I'm confused now.
To Reproduce
Expected behavior
I expect validation to pass when required is specified and when a field has a valid value.
Screenshots
n/a
Additional context
n/a
The text was updated successfully, but these errors were encountered:
If not required, it will only be validated if the value is not empty(nil,zero-value).
So without specifying required, it can be said that the field is optional.
Alright, but now I'm seeing that when I remove required from a string field, my custom filter and validator function does not get called and I'm ending up passing invalid data which gets accepted, which should not happen 😔
System (please complete the following information):
linux
1.20
1.4.6
Describe the bug
Not necessarily a bug.
How exactly does
required
work?Suppose we have the following case
I'm getting a validation error name is required to not be empty as if I did not specify the the field
Name
. If I leave out therequired
validator it works.So the question is, when exactly to we need to use the required validator?
Because if I don't specify required are we saying that the field is optional? Or does required only work with pointer types?
Can you please explain the use cases and effects of this. I have just discovered that my validation rules were not running before because I made this PR #202 and that is why I'm confused now.
To Reproduce
Expected behavior
I expect validation to pass when
required
is specified and when a field has a valid value.Screenshots
n/a
Additional context
n/a
The text was updated successfully, but these errors were encountered: