z0mt3c / node-restify-validation

Validation for REST Services built with node-restify in node.js
MIT License
91 stars 49 forks source link

String min and max length #47

Open qrpike opened 8 years ago

qrpike commented 8 years ago

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,

gchauvet commented 8 years ago

You case use a regular expression for that :

/.{3,100}/g
qrpike commented 7 years ago

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

Thanks,

kimgysen commented 7 years ago

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

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