APIDevTools / json-schema-ref-parser

Parse, Resolve, and Dereference JSON Schema $ref pointers in Node and browsers
https://apitools.dev/json-schema-ref-parser
MIT License
952 stars 227 forks source link

Windows special character parsing bug #283

Closed philsturgeon closed 1 year ago

philsturgeon commented 1 year ago

The test suite is failing on windows for node v14 and we need to get that working before we can release a new version.

Run npm run coverage:node

> @apidevtools/json-schema-ref-parser@0.0.0-dev coverage:node D:\a\json-schema-ref-parser\json-schema-ref-parser
> nyc node_modules/mocha/bin/mocha

  File names with special characters
    1) should parse successfully

  0 passing (47ms)
  1 failing

  1) File names with special characters
       should parse successfully:
     TypeError [ERR_INVALID_URL]: Invalid URL: specs/__(%7B%5B%20%25%20&%20$%20%23%20@%20%60%20~%20,)%7D%5D__/__(%7B%5B%20%25%20&%20$%20%23%20@%20%60%20~%20,)%7D%5D__.yaml
      at new NodeError (internal/errors.js:322:7)
      at onParseError (internal/url.js:270:9)
      at new URL (internal/url.js:346:5)
      at Object.resolve (lib\util\url.js:8:137)
      at $RefParser.parse (lib\index.js:46:39)
      at Context.<anonymous> (test\specs\__({[ % & $ # @ ` ~ ,)}]__\special-characters.spec.js:13:33)
      at processImmediate (internal/timers.js:464:21)

Originally posted by @philsturgeon in https://github.com/APIDevTools/json-schema-ref-parser/issues/280#issuecomment-1275137692

wparad commented 1 year ago

I'm no windows expert, but I tried to repro the bug and I couldn't do it. What stack are you using? windows subsystem? git bash through mingw via git for windows or something else?

danielfcollier commented 1 year ago

@wparad, that's odd. I've run on Windows 10, and Node.js 14, then got the errors. I've opened this PR https://github.com/APIDevTools/json-schema-ref-parser/pull/286 to fix this bug, but there are some skipped problems on Windows. On Linux (Fedora), it works without any bugs.

wparad commented 1 year ago

@wparad, that's odd. I've run on Windows 10, and Node.js 14, then got the errors. I've opened this PR #286 to fix this bug, but there are some skipped problems on Windows. On Linux (Fedora), it works without any bugs.

Stack is important, are you using cmd? how did you install node, etc... etc... For instance I explicitly tried on nodejs 14 installed through nvm on git bash using git for windows. But that doesn't really matter now if you've figured out how to repro the problem.

danielfcollier commented 1 year ago

Simple Windows 10 setup, VSCode installed, Node.js v14, Git Bash, and terminal with Power Shell (built-in). I'm not a Windows developer, but this is the setup that I used on a VM with Fedora 36.

philsturgeon commented 1 year ago

Closed by #286.