Skip to content

Commit

Permalink
fix: improve file $ref resolving on Windows (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip committed Mar 8, 2021
1 parent deaf2c1 commit af99014
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"dependencies": {
"@stoplight/better-ajv-errors": "0.0.4",
"@stoplight/json": "3.10.2",
"@stoplight/json-ref-readers": "1.2.1",
"@stoplight/json-ref-readers": "1.2.2",
"@stoplight/json-ref-resolver": "3.1.1",
"@stoplight/lifecycle": "2.3.2",
"@stoplight/path": "1.3.2",
Expand Down
10 changes: 8 additions & 2 deletions src/__tests__/linter.jest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,19 @@ console.log(this.cache.get('test') || this.cache.set('test', []).get('test'));
expect.arrayContaining([
expect.objectContaining({
code: 'invalid-ref',
message: `ENOENT: no such file or directory, open '${path.join(documentUri, '../broken-age.yaml')}'`,
message: `ENOENT: no such file or directory, open '${path.join(
normalize(documentUri),
'../broken-age.yaml',
)}'`,
path: ['age', '$ref'],
source: normalize(path.join(documentUri, '../user.json')),
}),
expect.objectContaining({
code: 'invalid-ref',
message: `ENOENT: no such file or directory, open '${path.join(documentUri, '../broken-length.json')}'`,
message: `ENOENT: no such file or directory, open '${path.join(
normalize(documentUri),
'../broken-length.json',
)}'`,
path: ['maxLength', '$ref'],
source: normalize(path.join(documentUri, '../name.json')),
}),
Expand Down
2 changes: 1 addition & 1 deletion src/rulesets/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createRulesetProcessor = (
return opts.ref;
},
async parseResolveResult(opts) {
opts.result = parseContent(opts.result, opts.targetAuthority.pathname());
opts.result = parseContent(opts.result, opts.targetAuthority.href());
return opts;
},
},
Expand Down
29 changes: 20 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,13 @@
jsonpointer "^4.0.1"
leven "^3.1.0"

"@stoplight/json-ref-readers@1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@stoplight/json-ref-readers/-/json-ref-readers-1.2.1.tgz#45061659cf46b60a7d9422858c4cd4c2a5d5e7c7"
integrity sha512-fbh8sXRrwfOCx4EA2e6FGUwvu5zxCQ9xHZg3vYDFSb1HLTlrCeRTdx3VCmYjCSGAhpcwgpB4zMc8kiudujo8Yg==
"@stoplight/json-ref-readers@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@stoplight/json-ref-readers/-/json-ref-readers-1.2.2.tgz#e5992bae597f228f988f362a4c0304c03a92008b"
integrity sha512-nty0tHUq2f1IKuFYsLM4CXLZGHdMn+X/IwEUIpeSOXt0QjMUbL0Em57iJUDzz+2MkWG83smIigNZ3fauGjqgdQ==
dependencies:
node-fetch "^2.6.0"
tslib "^1.14.1"

"@stoplight/json-ref-resolver@3.1.1":
version "3.1.1"
Expand Down Expand Up @@ -3113,7 +3114,12 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=

fsevents@^2.1.2, fsevents@~2.1.1, fsevents@~2.1.2:
fsevents@^2.1.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

fsevents@~2.1.1, fsevents@~2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805"
integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==
Expand Down Expand Up @@ -7181,11 +7187,16 @@ tslib@1.11.2:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.2.tgz#9c79d83272c9a7aaf166f73915c9667ecdde3cc9"
integrity sha512-tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg==

tslib@1.13.0, tslib@^1.12.0, tslib@^1.8.1, tslib@^1.9.0:
tslib@1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==

tslib@^1.12.0, tslib@^1.14.1, tslib@^1.8.1, tslib@^1.9.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
Expand Down Expand Up @@ -7258,9 +7269,9 @@ typedarray-to-buffer@^3.1.5:
is-typedarray "^1.0.0"

typescript@^3.9.7:
version "3.9.7"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
version "3.9.9"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.9.tgz#e69905c54bc0681d0518bd4d587cc6f2d0b1a674"
integrity sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==

ua-parser-js@0.7.21:
version "0.7.21"
Expand Down

0 comments on commit af99014

Please sign in to comment.