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 have looked at the documentation here first? Yes
I have looked at the examples provided that may showcase my question here? Yes in doc.go too
Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
exclude_if doesn't work with 'nil','true','false' values in provided parametrs
Examples:
// exclude the field if the Field1 is equal to the parameter given:
Usage: excluded_if=Field1 foobar
// exclude the field if the Field1 and Field2 is equal to the value respectively:
Usage: excluded_if=Field1 foo Field2 bar
Code sample, to showcase or reproduce:
typeStruct1struct {
Field1boolField2*string`validate:"excluded_if=Field1 false"`
}
typeStruct2struct {
Field1boolField2*string`validate:"excluded_if=!Field1"`
}
funcmain() {
ctx:=context.Background()
vldtr:=validator.New()
str:="321321"vldtr.StructCtx(ctx,Struct1{false, str})
vldtr.StructCtx(ctx, Struct2{false, str})
}
// Output: !panic recovered: Bad field type *int64
Output
The text was updated successfully, but these errors were encountered:
DarkReduX
changed the title
e
Exclude If doesn't work on boolean and nil parametr
Aug 20, 2024
Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
exclude_if doesn't work with 'nil','true','false' values in provided parametrs
Examples:
Code sample, to showcase or reproduce:
Output
The text was updated successfully, but these errors were encountered: