Skip to content
Snippets Groups Projects
Commit b9cf0863 authored by Alvaro Cabrera's avatar Alvaro Cabrera
Browse files

Lookup missing paths for references; fix #294 (async)

parent 5a188248
Branches
Tags
No related merge requests found
......@@ -41,8 +41,22 @@ jsf.resolve = <jsfAPI>function(schema: JsonSchema, refs?: any, cwd?: string) {
cwd = cwd || (typeof process !== 'undefined' ? process.cwd() : '');
cwd = cwd.replace(/\/+$/, '') + '/';
var $refs = getRefs(refs);
// identical setup as json-schema-sequelizer
const fixedRefs = {
order: 300,
canRead: true,
read(file, callback) {
callback(null, deref.util.findByRef(cwd !== '/'
? file.url.replace(cwd, '')
: file.url, $refs));
},
};
return $RefParser
.dereference(cwd, schema, {
resolve: { fixedRefs },
dereference: {
circular: 'ignore',
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment