Skip to content

Commit 3fe2852

Browse files
committed
fix(semval): don't fail on well-formed remote full document refs
1 parent b711f44 commit 3fe2852

File tree

2 files changed

+11
-5
lines changed
  • src/plugins/validate-semantic/validators/2and3
  • test/plugins/validate-semantic/2and3

2 files changed

+11
-5
lines changed

src/plugins/validate-semantic/validators/2and3/refs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const validate2And3RefPathFormatting = () => (system) => {
6464
// eslint-disable-next-line no-unused-vars
6565
const [refUrl, refPath] = value.split("#")
6666

67-
if(!refPath || refPath[0] !== "/") {
67+
if(refPath && refPath[0] !== "/") {
6868
errors.push({
6969
// $ref instead of $$ref
7070
path: [...node.path.slice(0, -1), "$ref"],

test/plugins/validate-semantic/2and3/refs.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,14 @@ describe("validation plugin - semantic - 2and3 refs", function() {
296296
paths: {
297297
"/CoolPath": {
298298
$ref: "http://google.com#/myObj/abc"
299-
}
299+
},
300300
},
301301
myObj: {
302302
abc: {
303-
type: "string"
303+
type: "string",
304+
properties: {
305+
$ref: "http://google.com/MyRegularURLReference"
306+
}
304307
}
305308
}
306309
}
@@ -318,11 +321,14 @@ describe("validation plugin - semantic - 2and3 refs", function() {
318321
paths: {
319322
"/CoolPath": {
320323
$ref: "http://google.com#/myObj/abc"
321-
}
324+
},
322325
},
323326
myObj: {
324327
abc: {
325-
type: "string"
328+
type: "string",
329+
properties: {
330+
$ref: "http://google.com/MyRegularURLReference"
331+
}
326332
}
327333
}
328334
}

0 commit comments

Comments
 (0)