is-my-json-valid: v2.17.0 introduces a regression

I do not use this package directly, but xo does.

After you released 2.17.0 xo doesn’t run anymore with this error:

If you break retro-compatibility, you are supposed to to a major version bump.

/builds/***/node_modules/is-my-json-valid/index.js:366
      visit(name+'['+i+']', node.items, reporter, filter, schemaPath.concat('items'))
                                                                     ^

TypeError: Cannot read property 'concat' of undefined
    at visit (/builds/***/node_modules/is-my-json-valid/index.js:366:70)
    at /build/***/node_modules/is-my-json-valid/index.js:416:9
    at Array.forEach (<anonymous>)
    at visit (/builds/***/node_modules/is-my-json-valid/index.js:409:18)
    at /builds/***/node_modules/is-my-json-valid/index.js:543:9
    at Array.forEach (<anonymous>)
    at visit (/builds/***/node_modules/is-my-json-valid/index.js:540:31)
    at compile (/builds/***/node_modules/is-my-json-valid/index.js:565:3)
    at visit (/builds/***/node_modules/is-my-json-valid/index.js:340:16)
    at /builds/***/node_modules/is-my-json-valid/index.js:416:9

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 33
  • Comments: 41 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Fix published as 2.17.1, so sorry for any inconvenience caused!

Would like to take this opportunity to plug lock files 🔒📝

By using npm 5 or newer, or yarn, a package-lock.json (or yarn.lock) file will automatically be created when adding or removing dependencies. This file will contain the exact version of every dependency (even the dependency of your dependencies, and so forth). Whenever npm install (or yarn) is run, it will look for this file and install the exact dependencies as the last time, thus ensuring that your builds are reproducible.

The file should be commited together with the rest of the code, so that everyone that works on the project have the same versions of every dependency, and so that the CI and deploy also uses the same versions.

More reading: “Yarn determinism” blog post, package-lock.json on npm docs, yarn.lock on yarn docs

Again, sorry for any inconvenience, hopefully this wont happen again, but I would advice everyone to start using lock files to minimize the impact if (when 😄) it happens the next time. If anyone is in London I’d be happy to buy you a beer and discuss lock files and JavaScript 😄

Cheers 🍻

I believe it’s already obvious this is a major issue, so I’d like to suggest everyone to just subscribe on this issue instead of adding more “Same here” comments.

Same here, using eslint…

Super sorry for this 🙈

Will try to add more test coverage and possibly move to TypeScript to prevent this from happening again 👌

I’m broken too. As a workaround, you can install the previous version of this module:

npm install is-my-json-valid@2.16

This gets StandardJS (and presumably ESLint) working, because they will just pick up the installed @2.16 if it’s there.

@deBhal @LinusU, I guess you guys know the code better than most of us, so are probably in the best position to fix it. As a community, is there anything we can do to be helpful?

I’d also like to add my apologies to everyone inconvenienced, and my thanks to @LinusU and @shalevshalit @juliangruber @shalevshalit who all provided fixes so quickly while I was asleep.

Will try to add more test coverage

We did have tests here that looked pretty solid to me, so in addition to a PR here to cover this specific case (https://github.com/mafintosh/is-my-json-valid/pull/158) I’ve gone upstream to beef up the json-schema.org test-suite more generally as well (https://github.com/json-schema-org/JSON-Schema-Test-Suite/pull/211)

My build was failing but now is not. Fast work - thank you!

Thanks, for quick update! Will rerun our pipelines

@akryvda, it’s already published: 2.17.1

Should we expect a hotfix in near future? 😃

same problem here.

Similar error @mafintosh