_validate = function validate(value, schema, opts) {
  var errors = [];
  opts || (opts = {});
  opts.ctx || (opts.ctx = {
    value: value,
    schema: schema
  });
  var shouldPop;
  var prevProp = opts.prop;

  if (schema === undefined) {
    return;
  }

  if (!utils.isObject(schema)) {
    throw utils.err("".concat(DOMAIN$5, "#validate"))(500, "Invalid schema at path: \"".concat(opts.path, "\""));
  }

  if (opts.path === undefined) {
    opts.path = [];
  } // Track our location as we recurse


  if (opts.prop !== undefined) {
    shouldPop = true;
    opts.path.push(opts.prop);
    opts.prop = undefined;
  } // Validate against parent schema


  if (schema.extends) {
    // opts.path = path
    // opts.prop = prop
    if (utils.isFunction(schema.extends.validate)) {
      errors = errors.concat(schema.extends.validate(value, opts) || []);
    } else {
      errors = errors.concat(_validate(value, schema.extends, opts) || []);
    }
  }

  if (value === undefined) {
    // Check if property is required
    if (schema.required === true && !opts.existingOnly) {
      addError(value, 'a value', opts, errors);
    }

    if (shouldPop) {
      opts.path.pop();
      opts.prop = prevProp;
    }

    return errors.length ? errors : undefined;
  }

  errors = errors.concat(validateAny(value, schema, opts) || []);

  if (shouldPop) {
    opts.path.pop();
    opts.prop = prevProp;
  }

  return errors.length ? errors : undefined;
}
Validates the provided value against a given Schema according to the http://json-schema.org/ v4 specification.

@name Schema.validate
@method
@param {*} value Value to be validated.
@param {object} schema Valid Schema according to the http://json-schema.org/ v4 specification.
@param {object} [opts] Configuration options.
@returns {(array|undefined)} Array of errors or `undefined` if valid.