-
Notifications
You must be signed in to change notification settings - Fork 1.4k
When the validation field does not exist #1399
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
Comments
Interesting scenario... |
It's possible to do type Request struct {
Name *string `json:"name" validate:"omitempty,gt=0"`
Email string `json:"email"`
} I am not sure if there is any other way how to do it. If you have to separate logic for not exist and null value, sadly with go we can do only this or using something like |
@nodivbyzero Hello, I can only tell if I have this field in my struct by the address right now, but I don't feel good about that, It's like this
With RegisterValidation, I can get the Form Struct, which is the Struct I created, but how can I get the JSON data that was passed in for the request? example:this is request data:
this my struct:
got my original request data via validateOptionalNotEmpty:
|
struct
How Customize one
optional_not_empty
to achieve the following results?cases
The text was updated successfully, but these errors were encountered: