aurelia / validatejs

Enables expressive validation using decorators and/or a fluent API.
MIT License
22 stars 23 forks source link

Not able to pass full options through to validate.js for url, presence, date, datetime and email validators #41

Closed apawsey closed 8 years ago

apawsey commented 8 years ago

In ValidationRule, the static properties that return the validation rule instances for those validator types, do not carry any config passed in through to the validate.js library (rather just passing true). Therefore the ability to set certain options, like overriding the validation message, is not possible.

plwalters commented 8 years ago

Hey this is great thanks - does this look like it will meet your needs -

  static presence(config = true) {
    return new ValidationRule('presence', config);
  }
plwalters commented 8 years ago

Basically instead of just hardcoding the config as true which is a valid option for those listed above we just supply a default value if none is passed and use that.

apawsey commented 8 years ago

Yup perfect, seems easier to just bring them in line with the others. Obviously this depends on whether you want us passing things through to validate.js or you want to abstract those settings somehow?

plwalters commented 8 years ago

Personally I love giving the developer full control over validatejs because it highlights how easy to use it is / should be. Perhaps there is a reason we want to abstract down the road but for now I love it the way it is :)

I'll get a fix in for this before tomorrow.