Validates the model
@method validate
@memberof Augmented.Model
@returns {array} Returns array of messages from validation
432585
function() {
            if (this.supportsValidation() && Augmented.ValidationFramework.supportsValidation()) {
              // validate from Validator
              this.validationMessages = Augmented.ValidationFramework.validate(this.toJSON(), this.schema);
            } else {
              this.validationMessages.valid = true;
            }
            return this.validationMessages;
          }
477279
function (validations) {
		if (!validations) {
			return this;
		}

		if (!this.validations) {
			this.validations = [];
		}

		var that = this;

		_.isArray(validations) || (validations = [ validations ]);

		_.each(validations, function (validation) {
			that.validations.push(validation);
		});

		return this;
	}
423424
function () {
    return validateData.apply(this, [this.options,
        undefined].concat(Array.prototype.slice.call(arguments)));
  }
186335
function() {
    var self = this
    var validations = []

    return self
      .callInterceptors('beforeValidation', [self])
      .then(function() {
        for (var field in self.definition.validations) {
          var fieldValidations = self.definition.validations[field]

          // set the scope of all validator function to the current record
          for (var i in fieldValidations) {
            validations.push(fieldValidations[i].bind(self))
          }
        }
        return self.store.utils.parallel(validations)
      })
      .then(function(result) {
        if (self.errors.has) throw self.errors
      })
      .then(function() {
        return self.callInterceptors('afterValidation', [self])
      })
      .then(function() {
        return self
      })
  }
1250140
def validate_model(  # noqa: C901 (ignore complexity)
    model: Union[BaseModel, Type[BaseModel]], input_data: 'DictStrAny', raise_exc: bool = True, cls: 'ModelOrDc' = None
) -> Union['DictStrAny', Tuple['DictStrAny', Optional[ValidationError]]]:
    
    values = {}
    errors = []
    names_used = set()
    config = model.__config__
    check_extra = config.extra is not Extra.ignore

    for name, field in model.__fields__.items():
        if type(field.type_) == ForwardRef:
            raise ConfigError(
                f'field "{field.name}" not yet prepared so type is still a ForwardRef, '
                f'you might need to call {model.__class__.__name__}.update_forward_refs().'
            )

        value = input_data.get(field.alias, _missing)
        using_name = False
        if value is _missing and config.allow_population_by_alias and field.alt_alias:
            value = input_data.get(field.name, _missing)
            using_name = True

        if value is _missing:
            if field.required:
                errors.append(ErrorWrapper(MissingError(), loc=field.alias, config=model.__config__))
                continue
            value = deepcopy(field.default)
            if not model.__config__.validate_all and not field.validate_always:
                values[name] = value
                continue
        elif check_extra:
            names_used.add(field.name if using_name else field.alias)

        v_, errors_ = field.validate(value, values, loc=field.alias, cls=cls or model.__class__)  # type: ignore
        if isinstance(errors_, ErrorWrapper):
            errors.append(errors_)
        elif isinstance(errors_, list):
            errors.extend(errors_)
        else:
            values[name] = v_

    if check_extra:
        extra = input_data.keys() - names_used
        if extra:
            if config.extra is Extra.allow:
                for f in extra:
                    values[f] = input_data[f]
            else:
                for f in sorted(extra):
                    errors.append(ErrorWrapper(ExtraError(), loc=f, config=config))

    if not raise_exc:
        return values, ValidationError(errors) if errors else None

    if errors:
        raise ValidationError(errors)
    return values
873896
function() {
		const message = this.get('message');
		const label = this.get('attributeLabel');

		Ember.assert('Message must be defined for this Validator', Ember.isPresent(message));

		const args = Array.prototype.slice.call(arguments);

		args.unshift(label);
		args.unshift(message);

		return format.apply(null, args);
	}
750193
function() {
      rulesArray = _explodeRules(_rules);

      for (var attribute in rulesArray) {

        var rules = rulesArray[attribute];
        for (var i in rules) {
          if (_errors[attribute]) {
            continue;
          };
          var ruleString  = rules[i];
          var parsedRule  = _parseRule(ruleString);
          var rule        = parsedRule.rule;
          var parameters  = parsedRule.parameters;
          var value       = _input[attribute] || null;
          var validatable = is_function(_resolvers[rule]);

          if (validatable && ! _resolvers[rule](attribute, value, parameters)) {
            _addFailure(attribute, rule, parameters);
          }
        }
      }

      return isEmptyObject(_errors);
    }
1190382
def validate_model(self):
        
        model: AssetAllocationModel = self.get_asset_allocation_model()
        model.logger = self.logger

        valid = model.validate()
        if valid:
            print(f"The model is valid. Congratulations")
        else:
            print(f"The model is invalid.")
2481
function(value, attr, required, model, computed) {
        var isRequired = _.isFunction(required) ? required.call(model, value, attr, computed) : required;
        if(!isRequired && !hasValue(value)) {
          return false; // overrides all other validators
        }
        if (isRequired && !hasValue(value)) {
          return this.format(getMessageKey(this.msgKey, defaultMessages.required), this.formatLabel(attr, model));
        }
      }
433602
def validate(context_name = default_validation_context)
      errors.clear
      validation_violations(context_name).each { |v| errors.add(v) }

      self
    end
1099431
function() {
          var myValidator;
          if (myValidator === undefined) {
            myValidator = new Validator();
          }
          /**
          * Returns if the framework supports validation
          * @method supportsValidation
          * @returns {boolean} Returns true if the framework supports validation
          * @memberof Augmented.ValidationFramework
          */
          this.supportsValidation = function() {
            return (myValidator !== null);
          };
          /**
          * Registers a schema to the Framework
          * @method registerSchema
          * @param {string} identity The identity of the schema
          * @param {object} schema The JSON schema
          * @memberof Augmented.ValidationFramework
          */
          this.registerSchema = function(identity, schema) {
            myValidator.addSchema(identity, schema);
          };
          /**
          * Gets a schema
          * @method getSchema
          * @param {string} identity The identity of the schema
          * @returns {object} The JSON schema
          * @memberof Augmented.ValidationFramework
          */
          this.getSchema = function(identity) {
            return myValidator.getSchema(identity);
          };
          /**
          * Gets all schemas
          * @method getSchemas
          * @returns {array} all JSON schemas
          * @memberof Augmented.ValidationFramework
          */
          this.getSchemas = function() {
            return myValidator.getSchemaMap();
          };
          /**
          * Clears all schemas
          * @method clearSchemas
          * @memberof Augmented.ValidationFramework
          */
          this.clearSchemas = function() {
            myValidator.dropSchemas();
          };
          /**
          * Validates data via a schema
          * @method validate
          * @param {object} data The data to validate
          * @param {object} The JSON schema
          * @returns {object} Returns the validation object
          * @memberof Augmented.ValidationFramework
          */
          this.validate = function(data, schema) {
            return myValidator.validateMultiple(data, schema);
          };
          /**
          * Validates data via a schema
          * @method getValidationMessages
          * @returns {array} Returns the validation messages
          * @memberof Augmented.ValidationFramework
          */
          this.getValidationMessages = function() {
            return myValidator.error;
          };

          this.generateSchema = function(model) {
            if (model && model instanceof Augmented.Model) {
              return Augmented.Utility.SchemaGenerator(model.toJSON());
            }

            return Augmented.Utility.SchemaGenerator(model);
          };
        }
975150
function assembleValidation(validation) {
  if (!_.isPlainObject(validation)) {
    validation = {rule: validation, params: []};
  }
  if (_.isString(validation.rule)) {
    var splitRule = validation.rule.split(':');
    validation.rule = splitRule[0];
    if (_.isEmpty(validation.params)) {
      validation.params = _.tail(splitRule);
    }
  } else if (!_.isFunction(validation.rule)) {
    throw new TypeError('Invalid validation');
  }
  return validation;
}
1123295
function( tmp, self ) {
      var _arg = self.options.validators.regExp[ tmp.arg ],
        _reg = new RegExp( _arg.pattern );
      return _reg.test( tmp.val ) || _arg.errorMessage;
    }
667368
function validateModel(json, model) {
    var schemaKeys = [];
    for (var keyInSchema in model) {
      schemaKeys.push(keyInSchema);
    }
    // Check if foreing keys are allowed.
    if (!model[SCHEMAALLOWUNKNOWN]) {
      // TODO ensure that null and false enter here.
      checkUnknown(json, schemaKeys);
    }
    for (var schemaKeyI = 0; schemaKeyI < schemaKeys.length; schemaKeyI++) {
      var node = null;
      var schemaKey = schemaKeys[schemaKeyI];
      if (json[schemaKey]) {
        node = json[schemaKey];
      }
      if (!isReservedWord(schemaKey)) {
        validateNode(node, model[schemaKey], schemaKey);
      }
    }
  }
440225
function (validation) {

            var validationArray = this._formatValidation(validation).split(','),
                oneValidation;

            for (var i = 0; i < validationArray.length; i++) {
                oneValidation = validationArray[i];
                if (/^[a-z]+$/i.test(oneValidation)) {
                    validationArray[i] = oneValidation.toUpperCase();
                }
            }

            return validationArray;
        }
890456
function () {
            this.errors = {};
            return flatten(this._static.validators.map(function runValidator(validator) {
                var col = validator.col, val = this.__values[validator.col], ret = validator.validate(val);
                this.errors[col] = ret;
                return ret;
            }, this));
        }
1205904
def validate(self, value, add_comments=False, schema_name="map"):
        
        validator = self.get_schema_validator(schema_name)

        error_messages = []

        if isinstance(value, list):
            for d in value:
                error_messages += self._validate(d, validator, add_comments, schema_name)
        else:
            error_messages = self._validate(value, validator, add_comments, schema_name)

        return error_messages