Collection handling fix.

This commit is contained in:
Bez Hermoso 2014-09-04 11:19:02 -07:00
parent 5fa69a0504
commit 0d17c10b70

View File

@ -448,19 +448,20 @@ class SwaggerFormatter implements FormatterInterface
case DataTypes::COLLECTION:
$type = 'array';
if ($prop['subType'] === DataTypes::MODEL) {
$ref = $this->registerModel(
if ($prop['subType'] === null) {
$items = array('type' => 'string');
} elseif (isset($this->typeMap[$prop['subType']])) {
$items = array('type' => $this->typeMap[$prop['subType']]);
} else {
$ref =
$this->registerModel(
$prop['subType'],
isset($prop['children']) ? $prop['children'] : null,
$prop['description'] ?: $prop['dataType']
);
$items = array(
'$ref' => $ref
'$ref' => $ref,
);
} elseif (isset($this->typeMap[$prop['subType']])) {
$items = array('type' => $this->typeMap[$prop['subType']]);
} else {
$items = array('type' => 'string');
}
break;
}