Merge branch 'release/1.2.3' into production

This commit is contained in:
Miroslav Bajtoš 2014-07-22 21:46:20 +02:00
commit 11f89e14e9
3 changed files with 24 additions and 6 deletions

View File

@ -79,12 +79,14 @@ var modelHelper = module.exports = {
out.type = modelHelper.getPropType(out.type); out.type = modelHelper.getPropType(out.type);
if (out.type === 'array') { if (out.type === 'array') {
var arrayProp = prop.type[0]; var hasItemType = typeof prop.type !== 'string' && prop.type.length;
if (!arrayProp.type) arrayProp = {type: arrayProp};
out.items = modelHelper.LDLPropToSwaggerDataType(arrayProp);
}
if (out.type === 'date') { if (hasItemType) {
var arrayProp = prop.type[0];
if (!arrayProp.type) arrayProp = {type: arrayProp};
out.items = modelHelper.LDLPropToSwaggerDataType(arrayProp);
}
} else if (out.type === 'date') {
out.type = 'string'; out.type = 'string';
out.format = 'date'; out.format = 'date';
} else if (out.type === 'buffer') { } else if (out.type === 'buffer') {

View File

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

View File

@ -80,6 +80,22 @@ describe('model-helper', function() {
type: 'string', format: 'date' type: 'string', format: 'date'
}}); }});
}); });
it('converts [] type', function() {
var def = getDefinition({
array: []
});
var prop = def.properties.array;
expect(prop).to.eql({ type: 'array' });
});
it('converts "array" type', function() {
var def = getDefinition({
array: 'array'
});
var prop = def.properties.array;
expect(prop).to.eql({ type: 'array' });
});
}); });
}); });
}); });