Validator: Validate oneof with values containing space

Created on 1 Oct 2019  路  3Comments  路  Source: go-playground/validator

Package version eg. v8, v9:

v9

Issue, Question or Enhancement:

Is it possible to use oneof validation with values containing space character? Tried with single quote but it did not seem to work.

Code sample, to showcase or reproduce:


type Data struct {
    Status string `json:"status" validate:"required,oneof='Awaiting Verification' 'Verified' 'Failed Verification'"`
}

enhancement good first issue question

Most helpful comment

Isn't this closed by #541

All 3 comments

@muhammadkholidb no, unfortunately, this isn't supported for oneoff at the moment.

As a workaround for now though is you can register your own custom validation function which accomplishes the same thing :)

Hello 馃憢 , I'm going to take a crack at this.

Isn't this closed by #541

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scisci picture scisci  路  5Comments

thaonx picture thaonx  路  3Comments

anam-digicom picture anam-digicom  路  4Comments

gwan284 picture gwan284  路  4Comments

romangithub1024 picture romangithub1024  路  5Comments