
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
ember-validatable-decorators
Advanced tools
Decorators for quick and easy validation for both ember data models and POJOs.
Add validations to your ember data models and/or POJOs easily.
ember install ember-validatable-decorators
To use validatable decorators you must addd @validatable decorators to your Model or POJO class first. This decorators add 3 methods to the class.
validate, validateOrReject and validateSync
This addon uses class-validator under the hood but more ember way.
I'll list all available decorators here when I have freetime but in the mean time you can the code.
import {
validatable,
min,
max,
contains,
int,
email,
fqdn,
date,
length,
} from 'ember-validatable-decorators';
import { attr } from '@ember-data/model';
import Model from '@ember-data/model';
@validatable
export default class PostModel extends Model {
@length(10, 20)
@attr('string')
title;
@contains('hello')
@attr('string')
text;
@int()
@min(0)
@max(10)
@attr('number')
rating;
@email()
@attr('string')
email;
@fqdn()
@attr('string')
site;
@date()
@attr('datetime')
createDate;
}
To check if model or POJO valid or not just need to call one of these 3 methods like this:
import { action } from '@ember/object';
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
@action
validate() {
this.model.validate();
}
}
And this call populates errors field in the model or POJO. You check check and display errors like this:
{{concat 'isValidated:' this.model.isValidated}}
{{#if this.model.isValid}}
<p>Valid</p>
{{else}}
<p>Invalid</p>
{{/if}}
{{#each this.model.errors as |error|}}
<div class='error'>
{{error.message}}
</div>
{{/each}}
<hr />
{{#each this.model.errors.rating as |error|}}
<div class='error'>
{{error.message}}
<br />
</div>
{{/each}}
<button type='button' {{on 'click' this.validate}}>
Validate
</button>
See the Contributing guide for details.
This project is licensed under the MIT License.
FAQs
Decorators for quick and easy validation for both ember data models and POJOs.
The npm package ember-validatable-decorators receives a total of 2 weekly downloads. As such, ember-validatable-decorators popularity was classified as not popular.
We found that ember-validatable-decorators demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.