go-playground / validator

:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
MIT License
16.53k stars 1.31k forks source link

Undefined validation function 'boolean' on field 'IsVisible' ? #1054

Closed DeveloperVusal closed 1 year ago

DeveloperVusal commented 1 year ago

I get an error: panic serving [::1]:61822: Undefined validation function 'boolean' on field 'IsVisible'

Dto struct:

type AddGroupDto struct {
    Name        string `json:"name" validate:"required,alphanumunicode"`
    ModeratorId uint   `json:"moderator_id,omitempty" validate:"omitempty,numeric"`
    IsVisible   bool   `json:"is_visible,omitempty" validate:"omitempty,boolean"`
    IsArchive   bool   `json:"is_archive,omitempty" validate:"omitempty,boolean"`
    IsDeleted   bool   `json:"is_deleted,omitempty" validate:"omitempty,boolean"`
}

JSON:

{
    "name": "Editor",
    "is_visivle": false
}

Help guys!

ashwek commented 1 year ago

@DeveloperVusal Are you sure you shared the correct Dto struct & JSON? I tried reproducing this issue, but i couldn't. Everything works fine.

https://play.golang.com/p/dK1q2rum8xo This is the playground link.

DeveloperVusal commented 1 year ago

Thanks for the example, the problem has been in the version (v9.31)