aurelia / validatejs

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

Decorators should be manually validatable #34

Closed drdwilcox closed 8 years ago

drdwilcox commented 8 years ago

I have a model that uses decorators to set validation rules. And I'm using ValidationEngine,getValidationReport(this.model); this.subscriber = this.reporter.subscribe(result => {...});

If the user doesn't change any fields, the observer never gets called, so I don't see any errors. I would like to be able to force the validation in my submit action just to make sure it's actually been done.

plwalters commented 8 years ago

I'm trying to get this in to todays' release -

class Model {
  @required name = '';
}

let obj = new Model();

this.validator = new Validator(obj);
this.validator.validate();

does this look like it covers your scenarios for now? The API still may be in flux a bit over the next week so improvements or suggestions welcome.

drdwilcox commented 8 years ago

I believe it would. It has the advantage of being similar to the mechanism for the fluent api, so switching from one to the other would be intuitive.

plwalters commented 8 years ago

Should be in yesterdays release.