Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
array: {
ArrayComponent: ArrayComponent,
ArrayItemComponent: ArrayItemComponent
}
}
});
export const curAjv = new ajv({
allErrors: true,
jsonPointers: true,
useDefaults: true,
format: "full",
$data: true,
errorDataPath: "property",
removeAdditional: true,
});
ajvErrors.default(curAjv, {
keepErrors: false,
singleError: false
});
curAjv.addKeyword("idExists", {
async: true,
type: "string",
validate: checkIdExists
});
function checkIdExists(schema, data) {
console.log("dfjkladjsklfklakdls");
return new Promise((resolve, reject) => {
setTimeout(() => {
if (data === "nick") {
return resolve(true);
}
reject(new ajv.ValidationError([new Error("idExists不是nick")]));