build/breeze.debug.js
function validateTarget(target, coIndex) {
    var ok = true;
    var stype = target.entityType || target.complexType;
    var aspect = target.entityAspect || target.complexAspect;
    var entityAspect = target.entityAspect || target.complexAspect.getEntityAspect();
    var context = { entity: entityAspect.entity  };
    if (coIndex !== undefined) {
      context.index = coIndex;
    }

    stype.getProperties().forEach(function (p) {
      var value = target.getProperty(p.name);
      var validators = p.getAllValidators();
      if (validators.length > 0) {
        context.property = p;
        context.propertyName = aspect.getPropertyPath(p.name);
        ok = entityAspect._validateProperty(value, context) && ok;
      }
      if (p.isComplexProperty) {
        if (p.isScalar) {
          ok = validateTarget(value) && ok;
        } else {
          ok = value.reduce(function (pv, cv, ix) {
            return validateTarget(cv, ix) && pv;
          }, ok);
        }
      }
    });


    // then target level
    stype.getAllValidators().forEach(function (validator) {
      ok = validate(entityAspect, validator, target) && ok;
    });
    return ok;
  }
function validateTarget(target, coIndex) {
    var ok = true;
    var stype = target.entityType || target.complexType;
    var aspect = target.entityAspect || target.complexAspect;
    var entityAspect = target.entityAspect || target.complexAspect.getEntityAspect();
    var context = { entity: entityAspect.entity  };
    if (coIndex !== undefined) {
      context.index = coIndex;
    }

    stype.getProperties().forEach(function (p) {
      var value = target.getProperty(p.name);
      var validators = p.getAllValidators();
      if (validators.length > 0) {
        context.property = p;
        context.propertyName = aspect.getPropertyPath(p.name);
        ok = entityAspect._validateProperty(value, context) && ok;
      }
      if (p.isComplexProperty) {
        if (p.isScalar) {
          ok = validateTarget(value) && ok;
        } else {
          ok = value.reduce(function (pv, cv, ix) {
            return validateTarget(cv, ix) && pv;
          }, ok);
        }
      }
    });


    // then target level
    stype.getAllValidators().forEach(function (validator) {
      ok = validate(entityAspect, validator, target) && ok;
    });
    return ok;
  }
function validateTarget ( target , coIndex ) { var ok = true ; var stype = target . entityType || target . complexType ; var aspect = target . entityAspect || target . complexAspect ; var entityAspect = target . entityAspect || target . complexAspect . getEntityAspect ( ) ; var context = { entity : entityAspect . entity } ; if ( coIndex !== undefined ) { context . index = coIndex ; } stype . getProperties ( ) . forEach ( function ( p ) { var value = target . getProperty ( p . name ) ; var validators = p . getAllValidators ( ) ; if ( validators . length > 0 ) { context . property = p ; context . propertyName = aspect . getPropertyPath ( p . name ) ; ok = entityAspect . _validateProperty ( value , context ) && ok ; } if ( p . isComplexProperty ) { if ( p . isScalar ) { ok = validateTarget ( value ) && ok ; } else { ok = value . reduce ( function ( pv , cv , ix ) { return validateTarget ( cv , ix ) && pv ; } , ok ) ; } } } ) ; // then target level stype . getAllValidators ( ) . forEach ( function ( validator ) { ok = validate ( entityAspect , validator , target ) && ok ; } ) ; return ok ; }
coIndex is only used where target is a complex object that is part of an array of complex objects in which case ctIndex is the index of the target within the array.
coIndex is only used where target is a complex object that is part of an array of complex objects in which case ctIndex is the index of the target within the array .