Corrected to propagate properties from existing items object
This commit is contained in:
parent
33ca826573
commit
43e84c4cb1
|
@ -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';
|
||||
|
|
|
@ -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": {
|
||||
|
|
Loading…
Reference in New Issue