Merge pull request #64 from amarzavery/sway4
fix resolving directory of relative swagger references
This commit is contained in:
Коммит
18bbf4b1bb
|
@ -15,8 +15,7 @@
|
|||
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-redis/2016-04-01/swagger/redis.json",
|
||||
"-j"
|
||||
],
|
||||
"env": {
|
||||
}
|
||||
"env": {}
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
|
|
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче