From 9f7fd193ff50309899288bd5ee1bdedf999087e2 Mon Sep 17 00:00:00 2001 From: twwu Date: Thu, 27 Mar 2025 10:56:29 +0800 Subject: [PATCH] feat: add precompile script for AJV and update schema validation logic --- .../components/workflow/nodes/llm/utils.ts | 15 ++++----- web/bin/precompile-ajv.js | 32 +++++++++++++++++++ web/package.json | 1 + web/public/validate-esm.mjs | 1 + 4 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 web/bin/precompile-ajv.js create mode 100644 web/public/validate-esm.mjs diff --git a/web/app/components/workflow/nodes/llm/utils.ts b/web/app/components/workflow/nodes/llm/utils.ts index 0b388bf72f..0756eee450 100644 --- a/web/app/components/workflow/nodes/llm/utils.ts +++ b/web/app/components/workflow/nodes/llm/utils.ts @@ -1,6 +1,7 @@ import { ArrayType, Type } from './types' import type { ArrayItems, Field, LLMNodeType } from './types' -import Ajv, { type ErrorObject } from 'ajv' +import type { ErrorObject } from 'ajv' +import { validateDraft07 } from '@/public/validate-esm.mjs' import produce from 'immer' export const checkNodeValid = (payload: LLMNodeType) => { @@ -82,11 +83,6 @@ export const findPropertyWithPath = (target: any, path: string[]) => { return current } -const ajv = new Ajv({ - allErrors: true, - verbose: true, -}) - export const validateSchemaAgainstDraft7 = (schemaToValidate: any) => { const schema = produce(schemaToValidate, (draft: any) => { // Make sure the schema has the $schema property for draft-07 @@ -94,9 +90,12 @@ export const validateSchemaAgainstDraft7 = (schemaToValidate: any) => { draft.$schema = 'http://json-schema.org/draft-07/schema#' }) - const valid = ajv.validateSchema(schema) + const valid = validateDraft07(schema) - return valid ? [] : ajv.errors || [] + // Access errors from the validation result + const errors = valid ? [] : (validateDraft07 as any).errors || [] + + return errors } export const getValidationErrorMessage = (errors: ErrorObject[]) => { diff --git a/web/bin/precompile-ajv.js b/web/bin/precompile-ajv.js new file mode 100644 index 0000000000..af74f05120 --- /dev/null +++ b/web/bin/precompile-ajv.js @@ -0,0 +1,32 @@ +const fs = require('node:fs') +const path = require('node:path') +const Ajv = require('ajv') +const standaloneCode = require('ajv/dist/standalone').default + +const ajv = new Ajv({ + allErrors: true, + verbose: true, + code: { source: true, esm: true }, +}) + +const moduleCode = standaloneCode(ajv, { + validateDraft07: 'http://json-schema.org/draft-07/schema#', +}) + +const preamble = [ + '"use strict";', +].join('') +const imports = new Set() +const requireRegex = /const (\S+)\s*=\s*require\((.+)\)\.(\S+);/g +const replaced = moduleCode + .replace(requireRegex, (_match, p1, p2, p3) => { + imports.add(`import { ${p3} as ${p1} } from ${p2};`) + return '' + }) + .replace('"use strict";', '') + +const uglyOutput = [preamble, Array.from(imports).join(''), replaced].join( + '', +) + +fs.writeFileSync(path.join(__dirname, '../public/validate-esm.mjs'), uglyOutput) diff --git a/web/package.json b/web/package.json index 2a55c558cf..047f1acb87 100644 --- a/web/package.json +++ b/web/package.json @@ -22,6 +22,7 @@ "test:watch": "jest --watch", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", + "precompile-ajv": "node ./bin/precompile-ajv", "preinstall": "npx only-allow pnpm" }, "dependencies": { diff --git a/web/public/validate-esm.mjs b/web/public/validate-esm.mjs new file mode 100644 index 0000000000..b85c95b079 --- /dev/null +++ b/web/public/validate-esm.mjs @@ -0,0 +1 @@ +"use strict";import { default as func0 } from "ajv/dist/runtime/equal";export const validateDraft07 = validate0;const schema0 = {"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true};const schema1 = {"type":"integer","minimum":0};const schema7 = {"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]};const schema9 = {"enum":["array","boolean","integer","null","number","object","string"]};const schema2 = {"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]};function validate1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(!(((typeof data == "number") && (!(data % 1) && !isNaN(data))) && (isFinite(data)))){const err0 = {instancePath,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer",schema:schema1.type,parentSchema:schema1,data};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if((typeof data == "number") && (isFinite(data))){if(data < 0 || isNaN(data)){const err1 = {instancePath,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0",schema:0,parentSchema:schema1,data};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}validate1.errors = vErrors;return errors === 0;}const schema4 = {"type":"array","minItems":1,"items":{"$ref":"#"}};const root0 = {validate: validate0};function validate3(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(Array.isArray(data)){if(data.length < 1){const err0 = {instancePath,schemaPath:"#/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:schema4,data};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0", limit: 0},message:"must be > 0",schema:0,parentSchema:schema0.properties.multipleOf,data:data8};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/multipleOf",schemaPath:"#/properties/multipleOf/type",keyword:"type",params:{type: "number"},message:"must be number",schema:schema0.properties.multipleOf.type,parentSchema:schema0.properties.multipleOf,data:data8};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.maximum !== undefined){let data9 = data.maximum;if(!((typeof data9 == "number") && (isFinite(data9)))){const err11 = {instancePath:instancePath+"/maximum",schemaPath:"#/properties/maximum/type",keyword:"type",params:{type: "number"},message:"must be number",schema:schema0.properties.maximum.type,parentSchema:schema0.properties.maximum,data:data9};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.exclusiveMaximum !== undefined){let data10 = data.exclusiveMaximum;if(!((typeof data10 == "number") && (isFinite(data10)))){const err12 = {instancePath:instancePath+"/exclusiveMaximum",schemaPath:"#/properties/exclusiveMaximum/type",keyword:"type",params:{type: "number"},message:"must be number",schema:schema0.properties.exclusiveMaximum.type,parentSchema:schema0.properties.exclusiveMaximum,data:data10};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.minimum !== undefined){let data11 = data.minimum;if(!((typeof data11 == "number") && (isFinite(data11)))){const err13 = {instancePath:instancePath+"/minimum",schemaPath:"#/properties/minimum/type",keyword:"type",params:{type: "number"},message:"must be number",schema:schema0.properties.minimum.type,parentSchema:schema0.properties.minimum,data:data11};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.exclusiveMinimum !== undefined){let data12 = data.exclusiveMinimum;if(!((typeof data12 == "number") && (isFinite(data12)))){const err14 = {instancePath:instancePath+"/exclusiveMinimum",schemaPath:"#/properties/exclusiveMinimum/type",keyword:"type",params:{type: "number"},message:"must be number",schema:schema0.properties.exclusiveMinimum.type,parentSchema:schema0.properties.exclusiveMinimum,data:data12};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.maxLength !== undefined){let data13 = data.maxLength;if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){const err15 = {instancePath:instancePath+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer",schema:schema1.type,parentSchema:schema1,data:data13};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if((typeof data13 == "number") && (isFinite(data13))){if(data13 < 0 || isNaN(data13)){const err16 = {instancePath:instancePath+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0",schema:0,parentSchema:schema1,data:data13};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}if(data.minLength !== undefined){if(!(validate1(data.minLength, {instancePath:instancePath+"/minLength",parentData:data,parentDataProperty:"minLength",rootData}))){vErrors = vErrors === null ? validate1.errors : vErrors.concat(validate1.errors);errors = vErrors.length;}}if(data.pattern !== undefined){let data15 = data.pattern;if(!(typeof data15 === "string")){const err17 = {instancePath:instancePath+"/pattern",schemaPath:"#/properties/pattern/type",keyword:"type",params:{type: "string"},message:"must be string",schema:schema0.properties.pattern.type,parentSchema:schema0.properties.pattern,data:data15};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.additionalItems !== undefined){if(!(validate0(data.additionalItems, {instancePath:instancePath+"/additionalItems",parentData:data,parentDataProperty:"additionalItems",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}if(data.items !== undefined){let data17 = data.items;const _errs35 = errors;let valid2 = false;const _errs36 = errors;if(!(validate0(data17, {instancePath:instancePath+"/items",parentData:data,parentDataProperty:"items",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}var _valid0 = _errs36 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs37 = errors;if(!(validate3(data17, {instancePath:instancePath+"/items",parentData:data,parentDataProperty:"items",rootData}))){vErrors = vErrors === null ? validate3.errors : vErrors.concat(validate3.errors);errors = vErrors.length;}var _valid0 = _errs37 === errors;valid2 = valid2 || _valid0;}if(!valid2){const err18 = {instancePath:instancePath+"/items",schemaPath:"#/properties/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:schema0.properties.items.anyOf,parentSchema:schema0.properties.items,data:data17};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}else {errors = _errs35;if(vErrors !== null){if(_errs35){vErrors.length = _errs35;}else {vErrors = null;}}}}if(data.maxItems !== undefined){let data18 = data.maxItems;if(!(((typeof data18 == "number") && (!(data18 % 1) && !isNaN(data18))) && (isFinite(data18)))){const err19 = {instancePath:instancePath+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer",schema:schema1.type,parentSchema:schema1,data:data18};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if((typeof data18 == "number") && (isFinite(data18))){if(data18 < 0 || isNaN(data18)){const err20 = {instancePath:instancePath+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0",schema:0,parentSchema:schema1,data:data18};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}if(data.minItems !== undefined){if(!(validate1(data.minItems, {instancePath:instancePath+"/minItems",parentData:data,parentDataProperty:"minItems",rootData}))){vErrors = vErrors === null ? validate1.errors : vErrors.concat(validate1.errors);errors = vErrors.length;}}if(data.uniqueItems !== undefined){let data20 = data.uniqueItems;if(typeof data20 !== "boolean"){const err21 = {instancePath:instancePath+"/uniqueItems",schemaPath:"#/properties/uniqueItems/type",keyword:"type",params:{type: "boolean"},message:"must be boolean",schema:schema0.properties.uniqueItems.type,parentSchema:schema0.properties.uniqueItems,data:data20};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data.contains !== undefined){if(!(validate0(data.contains, {instancePath:instancePath+"/contains",parentData:data,parentDataProperty:"contains",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}if(data.maxProperties !== undefined){let data22 = data.maxProperties;if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){const err22 = {instancePath:instancePath+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer",schema:schema1.type,parentSchema:schema1,data:data22};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if((typeof data22 == "number") && (isFinite(data22))){if(data22 < 0 || isNaN(data22)){const err23 = {instancePath:instancePath+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0",schema:0,parentSchema:schema1,data:data22};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}if(data.minProperties !== undefined){if(!(validate1(data.minProperties, {instancePath:instancePath+"/minProperties",parentData:data,parentDataProperty:"minProperties",rootData}))){vErrors = vErrors === null ? validate1.errors : vErrors.concat(validate1.errors);errors = vErrors.length;}}if(data.required !== undefined){let data24 = data.required;if(Array.isArray(data24)){const len0 = data24.length;for(let i0=0; i0 1){const indices0 = {};for(;i1--;){let item0 = data24[i1];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];const err25 = {instancePath:instancePath+"/required",schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)",schema:true,parentSchema:schema7,data:data24};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;break;}indices0[item0] = i1;}}}else {const err26 = {instancePath:instancePath+"/required",schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type: "array"},message:"must be array",schema:schema7.type,parentSchema:schema7,data:data24};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.additionalProperties !== undefined){if(!(validate0(data.additionalProperties, {instancePath:instancePath+"/additionalProperties",parentData:data,parentDataProperty:"additionalProperties",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}if(data.definitions !== undefined){let data27 = data.definitions;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){for(const key0 in data27){if(!(validate0(data27[key0], {instancePath:instancePath+"/definitions/" + key0.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data27,parentDataProperty:key0,rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}}else {const err27 = {instancePath:instancePath+"/definitions",schemaPath:"#/properties/definitions/type",keyword:"type",params:{type: "object"},message:"must be object",schema:schema0.properties.definitions.type,parentSchema:schema0.properties.definitions,data:data27};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}if(data.properties !== undefined){let data29 = data.properties;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){for(const key1 in data29){if(!(validate0(data29[key1], {instancePath:instancePath+"/properties/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data29,parentDataProperty:key1,rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}}else {const err28 = {instancePath:instancePath+"/properties",schemaPath:"#/properties/properties/type",keyword:"type",params:{type: "object"},message:"must be object",schema:schema0.properties.properties.type,parentSchema:schema0.properties.properties,data:data29};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data.patternProperties !== undefined){let data31 = data.patternProperties;if(data31 && typeof data31 == "object" && !Array.isArray(data31)){for(const key2 in data31){const _errs65 = errors;var valid11 = _errs65 === errors;if(!valid11){const err29 = {instancePath:instancePath+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames",keyword:"propertyNames",params:{propertyName: key2},message:"property name must be valid",schema:schema0.properties.patternProperties.propertyNames,parentSchema:schema0.properties.patternProperties,data:data31};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}for(const key3 in data31){if(!(validate0(data31[key3], {instancePath:instancePath+"/patternProperties/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data31,parentDataProperty:key3,rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}}else {const err30 = {instancePath:instancePath+"/patternProperties",schemaPath:"#/properties/patternProperties/type",keyword:"type",params:{type: "object"},message:"must be object",schema:schema0.properties.patternProperties.type,parentSchema:schema0.properties.patternProperties,data:data31};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data.dependencies !== undefined){let data33 = data.dependencies;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){for(const key4 in data33){let data34 = data33[key4];const _errs72 = errors;let valid14 = false;const _errs73 = errors;if(!(validate0(data34, {instancePath:instancePath+"/dependencies/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data33,parentDataProperty:key4,rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}var _valid1 = _errs73 === errors;valid14 = valid14 || _valid1;if(!valid14){const _errs74 = errors;if(Array.isArray(data34)){const len1 = data34.length;for(let i2=0; i2 1){const indices1 = {};for(;i3--;){let item1 = data34[i3];if(typeof item1 !== "string"){continue;}if(typeof indices1[item1] == "number"){j1 = indices1[item1];const err32 = {instancePath:instancePath+"/dependencies/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)",schema:true,parentSchema:schema7,data:data34};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;break;}indices1[item1] = i3;}}}else {const err33 = {instancePath:instancePath+"/dependencies/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type: "array"},message:"must be array",schema:schema7.type,parentSchema:schema7,data:data34};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}var _valid1 = _errs74 === errors;valid14 = valid14 || _valid1;}if(!valid14){const err34 = {instancePath:instancePath+"/dependencies/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/dependencies/additionalProperties/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:schema0.properties.dependencies.additionalProperties.anyOf,parentSchema:schema0.properties.dependencies.additionalProperties,data:data34};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}else {errors = _errs72;if(vErrors !== null){if(_errs72){vErrors.length = _errs72;}else {vErrors = null;}}}}}else {const err35 = {instancePath:instancePath+"/dependencies",schemaPath:"#/properties/dependencies/type",keyword:"type",params:{type: "object"},message:"must be object",schema:schema0.properties.dependencies.type,parentSchema:schema0.properties.dependencies,data:data33};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data.propertyNames !== undefined){if(!(validate0(data.propertyNames, {instancePath:instancePath+"/propertyNames",parentData:data,parentDataProperty:"propertyNames",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}if(data.enum !== undefined){let data37 = data.enum;if(Array.isArray(data37)){if(data37.length < 1){const err36 = {instancePath:instancePath+"/enum",schemaPath:"#/properties/enum/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:schema0.properties.enum,data:data37};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}let i4 = data37.length;let j2;if(i4 > 1){outer0:for(;i4--;){for(j2 = i4; j2--;){if(func0(data37[i4], data37[j2])){const err37 = {instancePath:instancePath+"/enum",schemaPath:"#/properties/enum/uniqueItems",keyword:"uniqueItems",params:{i: i4, j: j2},message:"must NOT have duplicate items (items ## "+j2+" and "+i4+" are identical)",schema:true,parentSchema:schema0.properties.enum,data:data37};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;break outer0;}}}}}else {const err38 = {instancePath:instancePath+"/enum",schemaPath:"#/properties/enum/type",keyword:"type",params:{type: "array"},message:"must be array",schema:schema0.properties.enum.type,parentSchema:schema0.properties.enum,data:data37};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data.type !== undefined){let data38 = data.type;const _errs83 = errors;let valid20 = false;const _errs84 = errors;if(!(((((((data38 === "array") || (data38 === "boolean")) || (data38 === "integer")) || (data38 === "null")) || (data38 === "number")) || (data38 === "object")) || (data38 === "string"))){const err39 = {instancePath:instancePath+"/type",schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues: schema9.enum},message:"must be equal to one of the allowed values",schema:schema9.enum,parentSchema:schema9,data:data38};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}var _valid2 = _errs84 === errors;valid20 = valid20 || _valid2;if(!valid20){const _errs86 = errors;if(Array.isArray(data38)){if(data38.length < 1){const err40 = {instancePath:instancePath+"/type",schemaPath:"#/properties/type/anyOf/1/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:schema0.properties.type.anyOf[1],data:data38};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}const len2 = data38.length;for(let i5=0; i5 1){outer1:for(;i6--;){for(j3 = i6; j3--;){if(func0(data38[i6], data38[j3])){const err42 = {instancePath:instancePath+"/type",schemaPath:"#/properties/type/anyOf/1/uniqueItems",keyword:"uniqueItems",params:{i: i6, j: j3},message:"must NOT have duplicate items (items ## "+j3+" and "+i6+" are identical)",schema:true,parentSchema:schema0.properties.type.anyOf[1],data:data38};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;break outer1;}}}}}else {const err43 = {instancePath:instancePath+"/type",schemaPath:"#/properties/type/anyOf/1/type",keyword:"type",params:{type: "array"},message:"must be array",schema:schema0.properties.type.anyOf[1].type,parentSchema:schema0.properties.type.anyOf[1],data:data38};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}var _valid2 = _errs86 === errors;valid20 = valid20 || _valid2;}if(!valid20){const err44 = {instancePath:instancePath+"/type",schemaPath:"#/properties/type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:schema0.properties.type.anyOf,parentSchema:schema0.properties.type,data:data38};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}else {errors = _errs83;if(vErrors !== null){if(_errs83){vErrors.length = _errs83;}else {vErrors = null;}}}}if(data.format !== undefined){let data40 = data.format;if(typeof data40 !== "string"){const err45 = {instancePath:instancePath+"/format",schemaPath:"#/properties/format/type",keyword:"type",params:{type: "string"},message:"must be string",schema:schema0.properties.format.type,parentSchema:schema0.properties.format,data:data40};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data.contentMediaType !== undefined){let data41 = data.contentMediaType;if(typeof data41 !== "string"){const err46 = {instancePath:instancePath+"/contentMediaType",schemaPath:"#/properties/contentMediaType/type",keyword:"type",params:{type: "string"},message:"must be string",schema:schema0.properties.contentMediaType.type,parentSchema:schema0.properties.contentMediaType,data:data41};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}if(data.contentEncoding !== undefined){let data42 = data.contentEncoding;if(typeof data42 !== "string"){const err47 = {instancePath:instancePath+"/contentEncoding",schemaPath:"#/properties/contentEncoding/type",keyword:"type",params:{type: "string"},message:"must be string",schema:schema0.properties.contentEncoding.type,parentSchema:schema0.properties.contentEncoding,data:data42};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data.if !== undefined){if(!(validate0(data.if, {instancePath:instancePath+"/if",parentData:data,parentDataProperty:"if",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}if(data.then !== undefined){if(!(validate0(data.then, {instancePath:instancePath+"/then",parentData:data,parentDataProperty:"then",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}if(data.else !== undefined){if(!(validate0(data.else, {instancePath:instancePath+"/else",parentData:data,parentDataProperty:"else",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}if(data.allOf !== undefined){if(!(validate3(data.allOf, {instancePath:instancePath+"/allOf",parentData:data,parentDataProperty:"allOf",rootData}))){vErrors = vErrors === null ? validate3.errors : vErrors.concat(validate3.errors);errors = vErrors.length;}}if(data.anyOf !== undefined){if(!(validate3(data.anyOf, {instancePath:instancePath+"/anyOf",parentData:data,parentDataProperty:"anyOf",rootData}))){vErrors = vErrors === null ? validate3.errors : vErrors.concat(validate3.errors);errors = vErrors.length;}}if(data.oneOf !== undefined){if(!(validate3(data.oneOf, {instancePath:instancePath+"/oneOf",parentData:data,parentDataProperty:"oneOf",rootData}))){vErrors = vErrors === null ? validate3.errors : vErrors.concat(validate3.errors);errors = vErrors.length;}}if(data.not !== undefined){if(!(validate0(data.not, {instancePath:instancePath+"/not",parentData:data,parentDataProperty:"not",rootData}))){vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);errors = vErrors.length;}}}validate0.errors = vErrors;return errors === 0;} \ No newline at end of file