code: function ensureValid(schemaKeyRef, data) {
      var result;
      result = validate(schemaKeyRef, data);
      if (!result.valid) {
          var error = new Error(result.message);
          error.errors = result.errors;
          throw error;
      }
  }
docs: Validate data using schema, will throw an error if invalid
  Schema will be compiled and cached (using serialized JSON as key. [json-stable-stringify](https://github.com/substack/json-stable-stringify) is used to serialize.
  @param  {String|Object} schemaKeyRef key, ref or schema object
  @param  {Object} data to be validated
  @returns {void}
  @throws {Error} if invalid, will throw an error with the message set to text from
  @see {@link getErrorMessage}
  @private