node-restify-validation icon indicating copy to clipboard operation
node-restify-validation copied to clipboard

String min and max length

Open qrpike opened this issue 8 years ago • 3 comments

This is one of the most popular use cases to make sure people dont put names, etc. as an empty string or 1 character.

eg:

{
    name: {
        isRequired: true,
        minLength: 3,
        maxLength: 100
    }
}

Thanks,

qrpike avatar Aug 10 '16 07:08 qrpike

You case use a regular expression for that :

/.{3,100}/g

gchauvet avatar Aug 17 '16 17:08 gchauvet

Any news on this? It says its possible using min and max but still not working for me

Thanks,

qrpike avatar Jan 17 '17 17:01 qrpike

Using max only also doesn't work for me, as in:

{ fbName: { isRequired: true, max: 50 } }

kimgysen avatar Jun 28 '17 21:06 kimgysen