Skip to content

Commit

Permalink
fix: handle relative paths to schemas
Browse files Browse the repository at this point in the history
Recent changes to allow complex schemas broke this capability.

Fixes #5
  • Loading branch information
matmar10 committed Sep 29, 2021
1 parent c742341 commit 26e0452
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 26e0452

Please sign in to comment.