Coder Social home page Coder Social logo

Comments (3)

nabati avatar nabati commented on June 1, 2024 1

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.

nabati avatar nabati commented on June 1, 2024

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.

mtmacdonald avatar mtmacdonald commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.