json-schema-ref-parser icon indicating copy to clipboard operation
json-schema-ref-parser copied to clipboard

Dereferencing fails on Windows with CWD C:

Open morris opened this issue 8 years ago • 1 comments

To reproduce, create test.js somewhere:

var parser = require( 'json-schema-ref-parser' );
var path = require( 'path' );

parser.dereference( path.join( __dirname, 'test.yaml' ) );

Running test.js from cmd in working directory C:\ fails, running in C:\Users behaves correctly:

C:\>node C:\Users\me\workspace\json-schema-ref-parser-bug-cwd-c\test.js
(node:8048) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 5): SyntaxError: Unable to resolve $ref pointer "c:///Users/me/
workspace/json-schema-ref-parser-bug-cwd-c/test.yaml"

C:\>cd Users

C:\Users>node C:\Users\me\workspace\json-schema-ref-parser-bug-cwd-c\tes
t.js
(node:9092) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 4): SyntaxError: "c:/Users/me/workspace/json-schema-ref-parser-
bug-cwd-c/test.yaml" is not a valid JSON Schema

morris avatar Apr 24 '17 09:04 morris

Oh wow, thanks! Good catch! I'll get this fixed

JamesMessinger avatar Apr 24 '17 19:04 JamesMessinger