What problem does it solve?
ember-model-validator provides declarative client-side validation for Ember Data models. A3 uses it in 10 models (client, enrollment, contract, agency, user, dependent, carrier, plan, agent, payment) to validate data before saving to Firestore. Validations run client-side and produce error objects that are rendered inline in forms.
Core Features & Use Cases
- Static validations: Define a static validations property on a model to declare rules.
- Built-in validators: presence, format, length, inclusion, exclusion, numericality, acceptance, confirmation.
- Custom validators: Support custom validation rules and multiple conditions, including cross-field checks.
- Conditional validation: Validate or skip based on model state using if/unless conditions.
- Error handling and i18n: Exposes errors on the model, supports translation keys for messages, and inline error rendering.
- Triggering validation: Use validate() to run validations and populate errors; validate selectively with only or except.
Quick Start
Add a static validations property to your Ember Data model and configure the built-in or custom validators to enforce your data rules.