Fix resolve external references bug (#216)
This commit is contained in:
Родитель
650219c51d
Коммит
237053f428
|
@ -1,3 +1,6 @@
|
|||
### 02/05/2018 0.4.32
|
||||
- Fix bug for resolve external references introduced part of #202.
|
||||
|
||||
### 02/05/2018 0.4.31
|
||||
- Bug fix for the fix made to resolve jshint issues in #202.
|
||||
|
||||
|
|
|
@ -303,26 +303,28 @@ class SpecResolver {
|
|||
//resolving relative swaggers.
|
||||
if (result && result.definitions) {
|
||||
let unresolvedDefinitions = [];
|
||||
|
||||
let processDefinition = (defName) => {
|
||||
if (result.definitions[defName].allOf) {
|
||||
let matchFound = result.definitions[defName].allOf.some((item) => {
|
||||
return (!self.visitedEntities[`/definitions/${defName}`]);
|
||||
});
|
||||
if (matchFound) {
|
||||
let slicedDefinitionRef = `/definitions/${defName}`;
|
||||
let definitionObj = result.definitions[defName];
|
||||
utils.setObject(self.specInJson, slicedDefinitionRef, definitionObj);
|
||||
self.visitedEntities[slicedDefinitionRef] = definitionObj;
|
||||
return self.resolveRelativePaths(definitionObj, docPath, 'all');
|
||||
unresolvedDefinitions.push(() => {
|
||||
if (result.definitions[defName].allOf) {
|
||||
let matchFound = result.definitions[defName].allOf.some((item) => {
|
||||
return (!self.visitedEntities[`/definitions/${defName}`]);
|
||||
});
|
||||
if (matchFound) {
|
||||
let slicedDefinitionRef = `/definitions/${defName}`;
|
||||
let definitionObj = result.definitions[defName];
|
||||
utils.setObject(self.specInJson, slicedDefinitionRef, definitionObj);
|
||||
self.visitedEntities[slicedDefinitionRef] = definitionObj;
|
||||
return self.resolveRelativePaths(definitionObj, docPath, 'all');
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
for (const defName of utils.getKeys(result.definitions)) {
|
||||
unresolvedDefinitions.push(processDefinition(defName));
|
||||
processDefinition(defName);
|
||||
}
|
||||
|
||||
return utils.executePromisesSequentially(unresolvedDefinitions);
|
||||
}
|
||||
return Promise.resolve();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "oav",
|
||||
"version": "0.4.31",
|
||||
"version": "0.4.32",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -2395,7 +2395,7 @@
|
|||
"tunnel": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz",
|
||||
"integrity": "sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA=="
|
||||
"integrity": "sha1-0VMiVHSe02Yg/NEBCGVJWh+p0K4="
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
|
@ -2607,4 +2607,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "oav",
|
||||
"version": "0.4.31",
|
||||
"version": "0.4.32",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation",
|
||||
"email": "azsdkteam@microsoft.com",
|
||||
|
@ -55,4 +55,4 @@
|
|||
"test": "npm -s run-script jshint && mocha -t 100000",
|
||||
"start": "node ./lib/autorestPlugin/pluginHost.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче