fix resolving directory of relative swagger references

This commit is contained in:
Amar Zavery 2017-02-08 22:57:18 -08:00
Родитель bc93b145bb
Коммит 62045cc896
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -167,11 +167,12 @@ class SpecResolver {
let slicedRefName = refName.slice(1);
let reference = node['$ref'];
let parsedReference = utils.parseReferenceInSwagger(reference);
let docDir = path.dirname(docPath);
if (parsedReference.filePath) {
//assuming that everything in the spec is relative to it, let us join the spec directory
//and the file path in reference.
docPath = utils.joinPath(self.specDir, parsedReference.filePath);
docPath = utils.joinPath(docDir, parsedReference.filePath);
}
return utils.parseJson(docPath).then(function (result) {