How to use the aurelia-validation.ValidationRules.ensureObject function in aurelia-validation

To help you get started, we’ve selected a few aurelia-validation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jbockle / aurelia-json-schema-form / src / aurelia-json-schema-form / rules / array-rules.ts View on Github external
bind(ctrl: SfArray) {
    let rule = ValidationRules
      .ensureObject()
      .displayName(ctrl.form.$schema.title)
      .satisfies(() => true);
    if (ctrl.form.$required) {
      rule = rule.required();
    }
    if (Number.isInteger(ctrl.form.$schema.maxItems)) {
      rule = rule.maxItems(ctrl.form.$schema.maxItems);
    }
    if (Number.isInteger(ctrl.form.$schema.minItems)) {
      rule = rule.minItems(ctrl.form.$schema.minItems);
    }
    if (ctrl.form.$schema.uniqueItems) {
      // TODO: add unique items rule
    }
    rule.on(ctrl.model);
github jbockle / aurelia-json-schema-form / dist / es2015 / rules / array-rules.js View on Github external
bind(ctrl) {
        let rule = ValidationRules
            .ensureObject()
            .displayName(ctrl.form.$schema.title)
            .satisfies(() => true);
        if (ctrl.form.$required) {
            rule = rule.required();
        }
        if (Number.isInteger(ctrl.form.$schema.maxItems)) {
            rule = rule.maxItems(ctrl.form.$schema.maxItems);
        }
        if (Number.isInteger(ctrl.form.$schema.minItems)) {
            rule = rule.minItems(ctrl.form.$schema.minItems);
        }
        if (ctrl.form.$schema.uniqueItems) {
            // TODO: add unique items rule
        }
        rule.on(ctrl.model);