'use strict';
var formats = require('ajv/lib/compile/formats')();
var equal = require('ajv/lib/compile/equal');
var validate = (function() {
  var pattern0 = new RegExp('^resources/.*$');
  var refVal = [];
  var refVal1 = {
    "type": "string"
  };
  refVal[1] = refVal1;
  var refVal2 = {
    "description": "_id identifies a resource in the OADA API.",
    "type": "string",
    "pattern": "^resources/.*$"
  };
  refVal[2] = refVal2;
  var refVal3 = {
    "description": "The represenation of a path within an OADA server",
    "type": "string",
    "format": "uri-reference"
  };
  refVal[3] = refVal3;
  var refVal4 = (function() {
    var refVal = [];
    var refVal1 = (function() {
      var refVal = [];
      var refVal1 = {
        "description": "Indicates the type of change that occured.",
        "enum": ["merge", "delete"]
      };
      refVal[1] = refVal1;
      return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
        'use strict'; /*# sourceURL=https://formats.openag.io/oada/change/v1.schema.json */
        var vErrors = null;
        var errors = 0;
        if (rootData === undefined) rootData = data;
        if ((data && typeof data === "object" && !Array.isArray(data))) {
          if (true) {
            var errs__0 = errors;
            var valid1 = true;
            if (data.type === undefined) {
              valid1 = false;
              validate.errors = [{
                keyword: 'required',
                dataPath: (dataPath || '') + "",
                schemaPath: '#/required',
                params: {
                  missingProperty: 'type'
                },
                message: 'should have required property \'type\''
              }];
              return false;
            } else {
              var errs_1 = errors;
              var errs_2 = errors;
              var schema2 = refVal1.enum;
              var valid2;
              valid2 = false;
              for (var i2 = 0; i2 < schema2.length; i2++)
                if (equal(data.type, schema2[i2])) {
                  valid2 = true;
                  break;
                } if (!valid2) {
                validate.errors = [{
                  keyword: 'enum',
                  dataPath: (dataPath || '') + '.type',
                  schemaPath: '#/definitions/type/enum',
                  params: {
                    allowedValues: schema2
                  },
                  message: 'should be equal to one of the allowed values'
                }];
                return false;
              } else {}
              if (errors === errs_2) {}
              var valid2 = errors === errs_2;
              if (valid2) {}
              if (errors === errs_1) {}
              var valid1 = errors === errs_1;
            }
            if (valid1) {
              if (data.body === undefined) {
                valid1 = false;
                validate.errors = [{
                  keyword: 'required',
                  dataPath: (dataPath || '') + "",
                  schemaPath: '#/required',
                  params: {
                    missingProperty: 'body'
                  },
                  message: 'should have required property \'body\''
                }];
                return false;
              } else {
                var errs_1 = errors;
                var valid1 = errors === errs_1;
              }
              if (valid1) {}
            }
            if (errs__0 == errors) {}
          }
        } else {
          validate.errors = [{
            keyword: 'type',
            dataPath: (dataPath || '') + "",
            schemaPath: '#/type',
            params: {
              type: 'object'
            },
            message: 'should be object'
          }];
          return false;
        }
        if (errors === 0) {}
        validate.errors = vErrors;
        return errors === 0;
      };
    })();
    refVal1.schema = {
      "$id": "https://formats.openag.io/oada/change/v1.schema.json",
      "$schema": "http://json-schema.org/draft-07/schema#",
      "definitions": {
        "type": {
          "description": "Indicates the type of change that occured.",
          "enum": ["merge", "delete"]
        }
      },
      "type": "object",
      "description": "Tree-based change representation (OADA v1)",
      "required": ["type", "body"],
      "properties": {
        "type": {
          "$ref": "#/definitions/type"
        },
        "body": {
          "$comment": "Should probably narrow this schema down",
          "description": "The contents of what was changed."
        }
      },
      "examples": [{
        "body": {
          "test": "abc",
          "_rev": 1
        },
        "type": "merge"
      }]
    };
    refVal1.errors = null;
    refVal[1] = refVal1;
    var refVal2 = (function() {
      var pattern0 = new RegExp('^resources/.*$');
      var refVal = [];
      var refVal1 = (function() {
        var pattern0 = new RegExp('^resources/.*$');
        return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
          'use strict';
          var vErrors = null;
          var errors = 0;
          if (rootData === undefined) rootData = data;
          if ((data && typeof data === "object" && !Array.isArray(data))) {
            if (true) {
              var errs__0 = errors;
              var valid1 = true;
              if (data.type === undefined) {
                valid1 = false;
                validate.errors = [{
                  keyword: 'required',
                  dataPath: (dataPath || '') + "",
                  schemaPath: '#/required',
                  params: {
                    missingProperty: 'type'
                  },
                  message: 'should have required property \'type\''
                }];
                return false;
              } else {
                var errs_1 = errors;
                var schema1 = validate.schema.properties.type.enum;
                var valid1;
                valid1 = false;
                for (var i1 = 0; i1 < schema1.length; i1++)
                  if (equal(data.type, schema1[i1])) {
                    valid1 = true;
                    break;
                  } if (!valid1) {
                  validate.errors = [{
                    keyword: 'enum',
                    dataPath: (dataPath || '') + '.type',
                    schemaPath: '#/properties/type/enum',
                    params: {
                      allowedValues: schema1
                    },
                    message: 'should be equal to one of the allowed values'
                  }];
                  return false;
                } else {}
                if (errors === errs_1) {}
                var valid1 = errors === errs_1;
              }
              if (valid1) {
                if (data.body === undefined) {
                  valid1 = false;
                  validate.errors = [{
                    keyword: 'required',
                    dataPath: (dataPath || '') + "",
                    schemaPath: '#/required',
                    params: {
                      missingProperty: 'body'
                    },
                    message: 'should have required property \'body\''
                  }];
                  return false;
                } else {
                  var errs_1 = errors;
                  var valid1 = errors === errs_1;
                }
                if (valid1) {
                  var data1 = data.path;
                  if (data1 === undefined) {
                    valid1 = false;
                    validate.errors = [{
                      keyword: 'required',
                      dataPath: (dataPath || '') + "",
                      schemaPath: '#/required',
                      params: {
                        missingProperty: 'path'
                      },
                      message: 'should have required property \'path\''
                    }];
                    return false;
                  } else {
                    var errs_1 = errors;
                    var errs_2 = errors;
                    if ((typeof data1 === "number")) {
                      if (true) {}
                    }
                    if (errors === errs_2) {
                      if (typeof data1 === "string") {
                        if (!formats['uri-reference'].test(data1)) {
                          validate.errors = [{
                            keyword: 'format',
                            dataPath: (dataPath || '') + '.path',
                            schemaPath: '../../oada.schema.json#/definitions/path/format',
                            params: {
                              format: 'uri-reference'
                            },
                            message: 'should match format "uri-reference"'
                          }];
                          return false;
                        } else {}
                      } else {
                        validate.errors = [{
                          keyword: 'type',
                          dataPath: (dataPath || '') + '.path',
                          schemaPath: '../../oada.schema.json#/definitions/path/type',
                          params: {
                            type: 'string'
                          },
                          message: 'should be string'
                        }];
                        return false;
                      }
                      if (errors === errs_2) {}
                    }
                    var valid2 = errors === errs_2;
                    if (valid2) {}
                    if (errors === errs_1) {}
                    var valid1 = errors === errs_1;
                  }
                  if (valid1) {
                    var data1 = data.resource_id;
                    if (data1 === undefined) {
                      valid1 = false;
                      validate.errors = [{
                        keyword: 'required',
                        dataPath: (dataPath || '') + "",
                        schemaPath: '#/required',
                        params: {
                          missingProperty: 'resource_id'
                        },
                        message: 'should have required property \'resource_id\''
                      }];
                      return false;
                    } else {
                      var errs_1 = errors;
                      var errs_2 = errors;
                      if (typeof data1 === "string") {
                        if (!pattern0.test(data1)) {
                          validate.errors = [{
                            keyword: 'pattern',
                            dataPath: (dataPath || '') + '.resource_id',
                            schemaPath: '../../oada.schema.json#/definitions/_id/pattern',
                            params: {
                              pattern: '^resources/.*$'
                            },
                            message: 'should match pattern "^resources/.*$"'
                          }];
                          return false;
                        } else {}
                      } else {
                        validate.errors = [{
                          keyword: 'type',
                          dataPath: (dataPath || '') + '.resource_id',
                          schemaPath: '../../oada.schema.json#/definitions/_id/type',
                          params: {
                            type: 'string'
                          },
                          message: 'should be string'
                        }];
                        return false;
                      }
                      if (errors === errs_2) {}
                      var valid2 = errors === errs_2;
                      if (valid2) {}
                      if (errors === errs_1) {}
                      var valid1 = errors === errs_1;
                    }
                    if (valid1) {}
                  }
                }
              }
              if (errs__0 == errors) {}
            }
          } else {
            validate.errors = [{
              keyword: 'type',
              dataPath: (dataPath || '') + "",
              schemaPath: '#/type',
              params: {
                type: 'object'
              },
              message: 'should be object'
            }];
            return false;
          }
          if (errors === 0) {}
          validate.errors = vErrors;
          return errors === 0;
        };
      })();
      refVal1.schema = {
        "type": "object",
        "required": ["type", "body", "path", "resource_id"],
        "properties": {
          "type": {
            "enum": ["merge", "delete"]
          },
          "body": {
            "$comment": "Should probably narrow this schema down",
            "description": "The contents of what was changed."
          },
          "path": {
            "$ref": "../../oada.schema.json#/definitions/path"
          },
          "resource_id": {
            "$ref": "../../oada.schema.json#/definitions/_id"
          }
        }
      };
      refVal1.errors = null;
      refVal[1] = refVal1;
      var refVal2 = {
        "description": "The represenation of a path within an OADA server",
        "type": "string",
        "format": "uri-reference"
      };
      refVal[2] = refVal2;
      var refVal3 = {
        "description": "_id identifies a resource in the OADA API.",
        "type": "string",
        "pattern": "^resources/.*$"
      };
      refVal[3] = refVal3;
      return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
        'use strict'; /*# sourceURL=https://formats.openag.io/oada/change/v2.schema.json */
        var vErrors = null;
        var errors = 0;
        if (rootData === undefined) rootData = data;
        if (Array.isArray(data)) {
          var errs__0 = errors;
          var valid0;
          for (var i0 = 0; i0 < data.length; i0++) {
            var errs_1 = errors;
            if (!refVal1(data[i0], (dataPath || '') + '[' + i0 + ']', data, i0, rootData)) {
              if (vErrors === null) vErrors = refVal1.errors;
              else vErrors = vErrors.concat(refVal1.errors);
              errors = vErrors.length;
            } else {}
            if (errors === errs_1) {}
            var valid1 = errors === errs_1;
            if (!valid1) break;
          }
          if (errs__0 == errors) {}
        } else {
          validate.errors = [{
            keyword: 'type',
            dataPath: (dataPath || '') + "",
            schemaPath: '#/type',
            params: {
              type: 'array'
            },
            message: 'should be array'
          }];
          return false;
        }
        if (errors === 0) {}
        validate.errors = vErrors;
        return errors === 0;
      };
    })();
    refVal2.schema = {
      "$id": "https://formats.openag.io/oada/change/v2.schema.json",
      "$schema": "http://json-schema.org/draft-07/schema#",
      "definitions": {
        "change": {
          "type": "object",
          "required": ["type", "body", "path", "resource_id"],
          "properties": {
            "type": {
              "enum": ["merge", "delete"]
            },
            "body": {
              "$comment": "Should probably narrow this schema down",
              "description": "The contents of what was changed."
            },
            "path": {
              "$ref": "../../oada.schema.json#/definitions/path"
            },
            "resource_id": {
              "$ref": "../../oada.schema.json#/definitions/_id"
            }
          }
        }
      },
      "type": "array",
      "description": "Array-based change representation (OADA v2)",
      "items": {
        "$ref": "#/definitions/change"
      },
      "examples": [
        [{
          "resource_id": "resources/default:resources_bookmarks_123",
          "path": "",
          "body": {
            "rocks": {
              "_rev": 1
            },
            "_rev": 1
          },
          "type": "merge"
        }, {
          "resource_id": "resources/default:resources_rocks_123",
          "path": "/rocks",
          "body": {
            "test": "abc",
            "_rev": 1
          },
          "type": "merge"
        }]
      ]
    };
    refVal2.errors = null;
    refVal[2] = refVal2;
    return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
      'use strict'; /*# sourceURL=https://formats.openag.io/oada/change.schema.json */
      var vErrors = null;
      var errors = 0;
      if (rootData === undefined) rootData = data;
      var errs__0 = errors,
        prevValid0 = false,
        valid0 = false,
        passingSchemas0 = null;
      var errs_1 = errors;
      if (!refVal1(data, (dataPath || ''), parentData, parentDataProperty, rootData)) {
        if (vErrors === null) vErrors = refVal1.errors;
        else vErrors = vErrors.concat(refVal1.errors);
        errors = vErrors.length;
      } else {}
      if (errors === errs_1) {}
      var valid1 = errors === errs_1;
      if (valid1) {
        valid0 = prevValid0 = true;
        passingSchemas0 = 0;
      }
      var errs_1 = errors;
      if (!refVal2(data, (dataPath || ''), parentData, parentDataProperty, rootData)) {
        if (vErrors === null) vErrors = refVal2.errors;
        else vErrors = vErrors.concat(refVal2.errors);
        errors = vErrors.length;
      } else {}
      if (errors === errs_1) {}
      var valid1 = errors === errs_1;
      if (valid1 && prevValid0) {
        valid0 = false;
        passingSchemas0 = [passingSchemas0, 1];
      } else {
        if (valid1) {
          valid0 = prevValid0 = true;
          passingSchemas0 = 1;
        }
      }
      if (!valid0) {
        var err = {
          keyword: 'oneOf',
          dataPath: (dataPath || '') + "",
          schemaPath: '#/oneOf',
          params: {
            passingSchemas: passingSchemas0
          },
          message: 'should match exactly one schema in oneOf'
        };
        if (vErrors === null) vErrors = [err];
        else vErrors.push(err);
        errors++;
        validate.errors = vErrors;
        return false;
      } else {
        errors = errs__0;
        if (vErrors !== null) {
          if (errs__0) vErrors.length = errs__0;
          else vErrors = null;
        }
      }
      if (errors === 0) {}
      validate.errors = vErrors;
      return errors === 0;
    };
  })();
  refVal4.schema = {
    "$id": "https://formats.openag.io/oada/change.schema.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "description": "Wrapper type for any version of an OADA change document.",
    "oneOf": [{
      "$ref": "./change/v1.schema.json"
    }, {
      "$ref": "./change/v2.schema.json"
    }],
    "examples": [{
        "body": {
          "test": "abc",
          "_rev": 1
        },
        "type": "merge"
      },
      [{
        "resource_id": "resources/default:resources_bookmarks_123",
        "path": "",
        "body": {
          "rocks": {
            "_rev": 1
          },
          "_rev": 1
        },
        "type": "merge"
      }, {
        "resource_id": "resources/default:resources_rocks_123",
        "path": "/rocks",
        "body": {
          "test": "abc",
          "_rev": 1
        },
        "type": "merge"
      }]
    ]
  };
  refVal4.errors = null;
  refVal[4] = refVal4;
  return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
    'use strict'; /*# sourceURL=https://formats.openag.io/oada/websockets/change.schema.json */
    var vErrors = null;
    var errors = 0;
    if (rootData === undefined) rootData = data;
    if ((data && typeof data === "object" && !Array.isArray(data))) {
      if (true) {
        var errs__0 = errors;
        var valid1 = true;
        var data1 = data.requestId;
        if (data1 === undefined) {
          valid1 = false;
          validate.errors = [{
            keyword: 'required',
            dataPath: (dataPath || '') + "",
            schemaPath: '#/required',
            params: {
              missingProperty: 'requestId'
            },
            message: 'should have required property \'requestId\''
          }];
          return false;
        } else {
          var errs_1 = errors;
          if (Array.isArray(data1)) {
            if (data1.length < 1) {
              validate.errors = [{
                keyword: 'minItems',
                dataPath: (dataPath || '') + '.requestId',
                schemaPath: '#/properties/requestId/minItems',
                params: {
                  limit: 1
                },
                message: 'should NOT have fewer than 1 items'
              }];
              return false;
            } else {
              var errs__1 = errors;
              var valid1;
              for (var i1 = 0; i1 < data1.length; i1++) {
                var errs_2 = errors;
                var errs_3 = errors;
                if (typeof data1[i1] !== "string") {
                  validate.errors = [{
                    keyword: 'type',
                    dataPath: (dataPath || '') + '.requestId[' + i1 + ']',
                    schemaPath: '#/definitions/id/type',
                    params: {
                      type: 'string'
                    },
                    message: 'should be string'
                  }];
                  return false;
                }
                var valid3 = errors === errs_3;
                if (valid3) {}
                if (errors === errs_2) {}
                var valid2 = errors === errs_2;
                if (!valid2) break;
              }
              if (errs__1 == errors) {}
            }
          } else {
            validate.errors = [{
              keyword: 'type',
              dataPath: (dataPath || '') + '.requestId',
              schemaPath: '#/properties/requestId/type',
              params: {
                type: 'array'
              },
              message: 'should be array'
            }];
            return false;
          }
          if (errors === errs_1) {}
          var valid1 = errors === errs_1;
        }
        if (valid1) {
          var data1 = data.resourceId;
          if (data1 === undefined) {
            valid1 = false;
            validate.errors = [{
              keyword: 'required',
              dataPath: (dataPath || '') + "",
              schemaPath: '#/required',
              params: {
                missingProperty: 'resourceId'
              },
              message: 'should have required property \'resourceId\''
            }];
            return false;
          } else {
            var errs_1 = errors;
            var errs_2 = errors;
            if (typeof data1 === "string") {
              if (!pattern0.test(data1)) {
                validate.errors = [{
                  keyword: 'pattern',
                  dataPath: (dataPath || '') + '.resourceId',
                  schemaPath: '../../oada.schema.json#/definitions/_id/pattern',
                  params: {
                    pattern: '^resources/.*$'
                  },
                  message: 'should match pattern "^resources/.*$"'
                }];
                return false;
              } else {}
            } else {
              validate.errors = [{
                keyword: 'type',
                dataPath: (dataPath || '') + '.resourceId',
                schemaPath: '../../oada.schema.json#/definitions/_id/type',
                params: {
                  type: 'string'
                },
                message: 'should be string'
              }];
              return false;
            }
            if (errors === errs_2) {}
            var valid2 = errors === errs_2;
            if (valid2) {}
            if (errors === errs_1) {}
            var valid1 = errors === errs_1;
          }
          if (valid1) {
            var data1 = data.path_leftover;
            if (data1 === undefined) {
              valid1 = false;
              validate.errors = [{
                keyword: 'required',
                dataPath: (dataPath || '') + "",
                schemaPath: '#/required',
                params: {
                  missingProperty: 'path_leftover'
                },
                message: 'should have required property \'path_leftover\''
              }];
              return false;
            } else {
              var errs_1 = errors;
              var errs__1 = errors;
              var valid1 = false;
              var errs_2 = errors;
              if (Array.isArray(data1)) {
                if (data1.length < 1) {
                  var err = {
                    keyword: 'minItems',
                    dataPath: (dataPath || '') + '.path_leftover',
                    schemaPath: '#/properties/path_leftover/anyOf/0/minItems',
                    params: {
                      limit: 1
                    },
                    message: 'should NOT have fewer than 1 items'
                  };
                  if (vErrors === null) vErrors = [err];
                  else vErrors.push(err);
                  errors++;
                } else {
                  var errs__2 = errors;
                  var valid2;
                  for (var i2 = 0; i2 < data1.length; i2++) {
                    var data2 = data1[i2];
                    var errs_3 = errors;
                    var errs_4 = errors;
                    if ((typeof data2 === "number")) {
                      if (true) {}
                    }
                    if (errors === errs_4) {
                      if (typeof data2 === "string") {
                        if (!formats['uri-reference'].test(data2)) {
                          var err = {
                            keyword: 'format',
                            dataPath: (dataPath || '') + '.path_leftover[' + i2 + ']',
                            schemaPath: '#/definitions/path_leftover/format',
                            params: {
                              format: 'uri-reference'
                            },
                            message: 'should match format "uri-reference"'
                          };
                          if (vErrors === null) vErrors = [err];
                          else vErrors.push(err);
                          errors++;
                        } else {}
                      } else {
                        var err = {
                          keyword: 'type',
                          dataPath: (dataPath || '') + '.path_leftover[' + i2 + ']',
                          schemaPath: '#/definitions/path_leftover/type',
                          params: {
                            type: 'string'
                          },
                          message: 'should be string'
                        };
                        if (vErrors === null) vErrors = [err];
                        else vErrors.push(err);
                        errors++;
                      }
                      if (errors === errs_4) {}
                    }
                    var valid4 = errors === errs_4;
                    if (valid4) {}
                    if (errors === errs_3) {}
                    var valid3 = errors === errs_3;
                    if (!valid3) break;
                  }
                  if (errs__2 == errors) {}
                }
              } else {
                var err = {
                  keyword: 'type',
                  dataPath: (dataPath || '') + '.path_leftover',
                  schemaPath: '#/properties/path_leftover/anyOf/0/type',
                  params: {
                    type: 'array'
                  },
                  message: 'should be array'
                };
                if (vErrors === null) vErrors = [err];
                else vErrors.push(err);
                errors++;
              }
              if (errors === errs_2) {}
              var valid2 = errors === errs_2;
              valid1 = valid1 || valid2;
              if (!valid1) {
                var errs_2 = errors;
                var errs_3 = errors;
                if ((typeof data1 === "number")) {
                  if (true) {}
                }
                if (errors === errs_3) {
                  if (typeof data1 === "string") {
                    if (!formats['uri-reference'].test(data1)) {
                      var err = {
                        keyword: 'format',
                        dataPath: (dataPath || '') + '.path_leftover',
                        schemaPath: '#/definitions/path_leftover/format',
                        params: {
                          format: 'uri-reference'
                        },
                        message: 'should match format "uri-reference"'
                      };
                      if (vErrors === null) vErrors = [err];
                      else vErrors.push(err);
                      errors++;
                    } else {}
                  } else {
                    var err = {
                      keyword: 'type',
                      dataPath: (dataPath || '') + '.path_leftover',
                      schemaPath: '#/definitions/path_leftover/type',
                      params: {
                        type: 'string'
                      },
                      message: 'should be string'
                    };
                    if (vErrors === null) vErrors = [err];
                    else vErrors.push(err);
                    errors++;
                  }
                  if (errors === errs_3) {}
                }
                var valid3 = errors === errs_3;
                if (valid3) {}
                if (errors === errs_2) {}
                var valid2 = errors === errs_2;
                valid1 = valid1 || valid2;
                if (!valid1) {}
              }
              if (!valid1) {
                var err = {
                  keyword: 'anyOf',
                  dataPath: (dataPath || '') + '.path_leftover',
                  schemaPath: '#/properties/path_leftover/anyOf',
                  params: {},
                  message: 'should match some schema in anyOf'
                };
                if (vErrors === null) vErrors = [err];
                else vErrors.push(err);
                errors++;
                validate.errors = vErrors;
                return false;
              } else {
                errors = errs__1;
                if (vErrors !== null) {
                  if (errs__1) vErrors.length = errs__1;
                  else vErrors = null;
                }
              }
              if (errors === errs_1) {}
              var valid1 = errors === errs_1;
            }
            if (valid1) {
              if (data.change === undefined) {
                valid1 = false;
                validate.errors = [{
                  keyword: 'required',
                  dataPath: (dataPath || '') + "",
                  schemaPath: '#/required',
                  params: {
                    missingProperty: 'change'
                  },
                  message: 'should have required property \'change\''
                }];
                return false;
              } else {
                var errs_1 = errors;
                if (!refVal4(data.change, (dataPath || '') + '.change', data, 'change', rootData)) {
                  if (vErrors === null) vErrors = refVal4.errors;
                  else vErrors = vErrors.concat(refVal4.errors);
                  errors = vErrors.length;
                } else {}
                if (errors === errs_1) {}
                var valid1 = errors === errs_1;
              }
              if (valid1) {}
            }
          }
        }
        if (errs__0 == errors) {}
      }
    } else {
      validate.errors = [{
        keyword: 'type',
        dataPath: (dataPath || '') + "",
        schemaPath: '#/type',
        params: {
          type: 'object'
        },
        message: 'should be object'
      }];
      return false;
    }
    if (errors === 0) {}
    validate.errors = vErrors;
    return errors === 0;
  };
})();
validate.schema = {
  "$id": "https://formats.openag.io/oada/websockets/change.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "This is the format of an OADA websocket change notification (server to client)",
  "definitions": {
    "id": {
      "$ref": "request.schema.json#/properties/requestId"
    },
    "path_leftover": {
      "$ref": "../../oada.schema.json#/definitions/path"
    }
  },
  "type": "object",
  "required": ["requestId", "resourceId", "path_leftover", "change"],
  "properties": {
    "requestId": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/definitions/id"
      }
    },
    "resourceId": {
      "$ref": "../../oada.schema.json#/definitions/_id"
    },
    "path_leftover": {
      "anyOf": [{
        "type": "array",
        "minItems": 1,
        "items": {
          "$ref": "#/definitions/path_leftover"
        }
      }, {
        "$ref": "#/definitions/path_leftover"
      }]
    },
    "change": {
      "$ref": "../change.schema.json#"
    }
  }
};
validate.errors = null;
module.exports = validate;