From 26e04527f5bb3b2847328887a3cc584778368c68 Mon Sep 17 00:00:00 2001 From: Matthew J Martin <19975+matmar10@users.noreply.github.com> Date: Wed, 29 Sep 2021 18:09:42 -0400 Subject: [PATCH] fix: handle relative paths to schemas Recent changes to allow complex schemas broke this capability. Fixes #5 --- lib/spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/spec.js b/lib/spec.js index 9a2de0b..b249ee3 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -805,11 +805,11 @@ export default class Spec { path = '#'; } try { - const schema = await $RefParser.dereference(filename); + const schemaRelativePath = this.suite.resolveFile(filename); + const schema = await $RefParser.dereference(schemaRelativePath); const $refs = await $RefParser.resolve(schema); expectedSchema = $refs.get(path); } catch (e) { - console.error(e); throw new ResponseJSONSchemaValidationError(`${e.name} occurred while parsing the input schema in '${jsonSchemaInfo['$ref']}' \n ${e.message}`); } } else {