diff --git a/ts/index.ts b/ts/index.ts index 1b4778c28c982a69415f5b6bd5b589e369044db8..5b46b5452646099af9a1d16059061bcef4e439f1 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -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', },