lykmapipo / sails-hook-validation

Custom validation error messages for sails model with i18n support
104 stars 29 forks source link

Can enums be validated? #17

Closed xaxist closed 9 years ago

xaxist commented 9 years ago

I have a field named status in my User model. Any way I can have validation for that field?

status: 
        {
            type:         "string",
            enum:         ['activating', 'activated'],
            defaultsTo:   'activating',
            required:     true
        },
lykmapipo commented 9 years ago

@anupsarode

Sure you can, as long as you are using valid sails validations rules that applies to enums