Corrected to propagate properties from existing items object

This commit is contained in:
Shelby Sanders 2015-07-15 17:17:33 -07:00
parent 33ca826573
commit 43e84c4cb1
2 changed files with 11 additions and 4 deletions

View File

@ -258,15 +258,22 @@ var modelHelper = module.exports = {
var hasItemType = Array.isArray(ldlType.type) && ldlType.type.length;
var arrayItem = hasItemType && ldlType.type[0];
var newItems = null;
if (arrayItem) {
if(typeof arrayItem === 'object') {
swaggerType.items = modelHelper.LDLPropToSwaggerDataType(arrayItem);
newItems = modelHelper.LDLPropToSwaggerDataType(arrayItem);
} else {
swaggerType.items = { type: modelHelper.getPropType(arrayItem) };
newItems = { type: modelHelper.getPropType(arrayItem) };
}
} else {
// NOTE: `any` is not a supported type in swagger 1.2
swaggerType.items = { type: 'any' };
newItems = { type: 'any' };
}
if (typeof swaggerType.items !== 'object') {
swaggerType.items = {};
}
for (var key in newItems) {
swaggerType.items[key] = newItems[key];
}
} else if (swaggerType.type === 'date') {
swaggerType.type = 'string';

View File

@ -1,6 +1,6 @@
{
"name": "loopback-explorer",
"version": "1.8.0",
"version": "1.8.1",
"description": "Browse and test your LoopBack app's APIs",
"main": "index.js",
"scripts": {