Comments (3)
For the sake of future travellers:
I didn't pinpoint the exact root cause of this issue, but my best guess is that it was due to some dependency getting linked together in an incorrect way.
We are using a mono repo setup, and adding nohoist
to the root-most package.json resolved seems to have resolved this issue;
"workspaces": {
"packages": [
"apps/*",
],
"nohoist": ["**/ajv*", "**/ajv*/**"]
},
from ajv-errors.
Running this in another repo, same version of the libraries as far as I can see, but getting a different result. Not sure what the issue could be 🤔
async function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.title !== undefined){if(typeof data.title !== "string"){const err0 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(errors > 0){const emErrs0 = [];for(const err1 of vErrors){if(((((err1.keyword !== "errorMessage") && (!err1.emUsed)) && ((err1.instancePath === instancePath+"/title") || ((err1.instancePath.indexOf(instancePath+"/title") === 0) && (err1.instancePath[instancePath+"/title".length] === "/")))) && (err1.schemaPath.indexOf("#/properties/title") === 0)) && (err1.schemaPath["#/properties/title".length] === "/")){emErrs0.push(err1);err1.emUsed = true;}}if(emErrs0.length){const err2 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/errorMessage",keyword:"errorMessage",params:{errors: emErrs0},message:"this is an error message"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}const emErrs1 = [];for(const err3 of vErrors){if(!err3.emUsed){emErrs1.push(err3);}}vErrors = emErrs1;errors = emErrs1.length;}}}else {const err4 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(errors === 0){return data;}else {throw new Error0(vErrors);}}
Relevant parts are translated to the following instead.
emErrs0.push(err1);
err1.emUsed = true;
Any idea why this could be?
from ajv-errors.
I've seen this too. For me it happens when I've transpiled my ES6 usage with babel.
/Users/mark/Dev/wellplan/node_modules/node-json-migrator/node_modules/ajv/dist/compile/index.js:121
throw e;
^
SyntaxError: Unexpected token ':'
at new Function (<anonymous>)
at Ajv.compileSchema (/Users/mark/Dev/wellplan/node_modules/node-json-migrator/node_modules/ajv/lib/compile/index.ts:171:26)
at Ajv._compileSchemaEnv (/Users/mark/Dev/wellplan/node_modules/node-json-migrator/node_modules/ajv/lib/core.ts:718:24)
at Ajv.compile (/Users/mark/Dev/wellplan/node_modules/node-json-migrator/node_modules/ajv/lib/core.ts:370:34)
at Object.<anonymous> (/Users/mark/Dev/wellplan/node_modules/node-json-migrator/dist/plan/plan.js:29:27)
from ajv-errors.
Related Issues (20)
- Reference Error with relative JSON pointer HOT 1
- Custom error for minLength on array property is not working HOT 1
- Be able to set custom keyword for error messages HOT 1
- Receiving error that a dependency is missing after installing ajv-errors.
- Create different error for each validation per attribute HOT 3
- `JSONSchemaType` + `anyOf` corresponding to union over objects cannot correctly determine missing fields HOT 2
- Getting instancePath when using with ajv-keywords and uniqueItemProperties HOT 1
- errorMessage not being set on array of objects? HOT 1
- Keyword error replacement in nested objects it's not working
- Required Keyword Error Message - Error is raised at incorrect level HOT 3
- Question: use enum values in custom error message
- Not getting custom error message for "pattern" keyword
- Is it possible to define a "dictionary" of common error messages?
- errorMessage is not a standard keyword in the JSON Schema specification, hence linting fails HOT 1
- Is this project still being maintained?
- Not working in browser
- Issue when compiling standalone validator with ajv-errors and errorMessage:{ properties:{ HOT 1
- When using ajv-errors package I get this error "Cannot read property 'allErrors' of undefined" HOT 1
- is it possible to add identifier in error, to classify errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ajv-errors.