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: case DataTypes::COLLECTION:
$type = 'array'; $type = 'array';
if ($prop['subType'] === DataTypes::MODEL) { if ($prop['subType'] === null) {
$ref = $this->registerModel( $items = array('type' => 'string');
$prop['subType'],
isset($prop['children']) ? $prop['children'] : null,
$prop['description'] ?: $prop['dataType']
);
$items = array(
'$ref' => $ref
);
} elseif (isset($this->typeMap[$prop['subType']])) { } elseif (isset($this->typeMap[$prop['subType']])) {
$items = array('type' => $this->typeMap[$prop['subType']]); $items = array('type' => $this->typeMap[$prop['subType']]);
} else { } else {
$items = array('type' => 'string'); $ref =
$this->registerModel(
$prop['subType'],
isset($prop['children']) ? $prop['children'] : null,
$prop['description'] ?: $prop['dataType']
);
$items = array(
'$ref' => $ref,
);
} }
break; break;
} }