### function validate (object, schema, options) #### {Object} object the object to validate. #### {Object} schema (optional) the JSON Schema to validate against. #### {Object} options (optional) options controlling the validation process. See {@link #validate.defaults) for details. Validate <code>object</code> against a JSON Schema. If <code>object</code> is self-describing (i.e. has a <code>$schema</code> property), it will also be validated against the referenced schema. [TODO]: This behaviour bay be suppressed by setting the {@link #validate.options.???} option to <code>???</code>.[/TODO]  If <code>schema</code> is not specified, and <code>object</code> is not self-describing, validation always passes.  <strong>Note:</strong> in order to pass options but no schema, <code>schema</code> <em>must</em> be specified in the call to <code>validate()</code>; otherwise, <code>options</code> will be interpreted as the schema. <code>schema</code> may be passed as <code>null</code>, <code>undefinded</code>, or the empty object (<code>{}</code>) in this case.
function validate(object, schema, options) {
    options = mixin({}, validate.defaults, options);
    var errors = [];

    if (schema.type === 'array')
      validateProperty(object, object, '', schema, options, errors);
    else
      validateObject(object, schema, options, errors);

    //
    // TODO: self-described validation
    // if (! options.selfDescribing) { ... }
    //

    return {
      valid: !(errors.length),
      errors: errors
    };
  }