FieldLevel.Field().Type()
takes a dynamic value when a field is of a pointer type.
#1203
Open
2 tasks done
Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
When a custom tag defined with
RegisterValidation()
is added to a field of a pointer type, theFieldLevel
passed to the registered function behaves very strangely.For example, if a validated field is of the type
*string
,FieldLevel.Field().Type()
returns*string
if the actual value isnil
while it returnsstring
if the actual value is not nil.I expect it always returns
*string
because the original field is of the type*string
(notstring
).Maybe the package auto-dereferences validated fields? But the official documentation says nothing about it.
Code sample, to showcase or reproduce:
The text was updated successfully, but these errors were encountered: