Skip to content

Commit aa05447

Browse files
committed
fix constructor param order (thanks Daniel!); revert experimental changes
1 parent 00f024a commit aa05447

File tree

5 files changed

+29
-21
lines changed

5 files changed

+29
-21
lines changed

.vscode/tasks.json

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,34 @@
77
// ${cwd}: the current working directory of the spawned process
88

99
{
10-
"version": "0.1.0",
10+
"version": "2.0.0",
1111
"command": "npm",
12-
"isShellCommand": true,
13-
"suppressTaskName": true,
1412
"tasks": [
1513
{
16-
"taskName": "lint",
17-
"args": ["run", "lint"],
18-
"showOutput": "always",
14+
"label": "lint",
15+
"type": "shell",
16+
"args": [
17+
"run",
18+
"lint"
19+
],
1920
"problemMatcher": "$eslint-stylish",
20-
"isBuildCommand": true
21+
"group": {
22+
"_id": "build",
23+
"isDefault": false
24+
}
2125
},
2226
{
23-
"taskName": "test",
24-
"args": ["run", "mocha"],
25-
"showOutput": "always",
26-
"isTestCommand": true
27+
"label": "test",
28+
"type": "shell",
29+
"args": [
30+
"run",
31+
"mocha"
32+
],
33+
"problemMatcher": [],
34+
"group": {
35+
"_id": "test",
36+
"isDefault": false
37+
}
2738
}
2839
]
2940
}

lib/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ declare namespace $RefParser {
490490
public readonly code ="EUNMATCHEDRESOLVER";
491491
}
492492
export class MissingPointerError extends JSONParserError {
493-
public constructor(token: string | number, source: string);
493+
public constructor(token: string | number, source: string, unresolvableRefValue?: string, pathToUnresolvableRef?: string);
494494

495495
public readonly name = "MissingPointerError";
496496
public readonly code ="EMISSINGPOINTER";

lib/pointer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Pointer.prototype.resolve = function (obj, options, pathFromRoot) {
9797
let token = tokens[i];
9898
if (this.value[token] === undefined || this.value[token] === null) {
9999
this.value = null;
100-
throw new MissingPointerError(this.path, pathFromRoot, token, this.originalPath);
100+
throw new MissingPointerError(token, this.originalPath, this.path, pathFromRoot);
101101
}
102102
else {
103103
this.value = this.value[token];

lib/util/errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const UnmatchedResolverError = exports.UnmatchedResolverError = class UnmatchedR
9393
setErrorName(UnmatchedResolverError);
9494

9595
const MissingPointerError = exports.MissingPointerError = class MissingPointerError extends JSONParserError {
96-
constructor (unresolvableRefValue, pathToUnresolvableRef, unresolvableTokenInRef, path) {
96+
constructor (unresolvableTokenInRef, path, unresolvableRefValue, pathToUnresolvableRef) {
9797
super(`at "${getHash(pathToUnresolvableRef)}", token "${unresolvableTokenInRef}" in "${getHash(unresolvableRefValue)}" does not exist`, stripHash(path));
9898

9999
this.code = "EMISSINGPOINTER";

test/specs/usage/usage.spec.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,9 @@ describe("Usage", () => {
6767
}
6868
});
6969

70-
expect(parser.$refs.propertyMap["#/properties/bar"]).to.equal(path.abs("/") + "#/properties/foo");
71-
expect(parser.$refs.propertyMap["#/properties/baz"]).to.equal(path.abs("/") + "#/properties/foo/properties/id");
72-
// const expected = {
73-
// "#/properties/bar": path.abs("/") + "#/properties/foo",
74-
// "#/properties/baz": path.abs("/") + "#/properties/foo/properties/id"
75-
// };
76-
// expect(parser.$refs.propertyMap).to.deep.equal(expected);
70+
expect(parser.$refs.propertyMap).to.deep.equal({
71+
"#/properties/bar": path.abs("/") + "#/properties/foo",
72+
"#/properties/baz": path.abs("/") + "#/properties/foo/properties/id"
73+
});
7774
});
7875
});

0 commit comments

Comments
 (0)