mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Merge pull request #791 from Padam87/response-map
Use the response map in the html view
This commit is contained in:
commit
364ef73680
@ -675,6 +675,10 @@ class ApiDoc
|
||||
$data['response'] = $response;
|
||||
}
|
||||
|
||||
if ($parsedResponseMap = $this->parsedResponseMap) {
|
||||
$data['parsedResponseMap'] = $parsedResponseMap;
|
||||
}
|
||||
|
||||
if ($statusCodes = $this->statusCodes) {
|
||||
$data['statusCodes'] = $statusCodes;
|
||||
}
|
||||
|
@ -129,6 +129,12 @@ abstract class AbstractFormatter implements FormatterInterface
|
||||
$annotation['response'] = $this->compressNestedParameters($annotation['response']);
|
||||
}
|
||||
|
||||
if (isset($annotation['parsedResponseMap'])) {
|
||||
foreach ($annotation['parsedResponseMap'] as $statusCode => &$data) {
|
||||
$data['model'] = $this->compressNestedParameters($data['model']);
|
||||
}
|
||||
}
|
||||
|
||||
$annotation['id'] = strtolower($annotation['method']).'-'.str_replace('/', '-', $annotation['uri']);
|
||||
|
||||
return $annotation;
|
||||
|
@ -30,7 +30,10 @@ class SimpleFormatter extends AbstractFormatter
|
||||
{
|
||||
$array = array();
|
||||
foreach ($collection as $coll) {
|
||||
$array[$coll['resource']][] = $coll['annotation']->toArray();
|
||||
$annotationArray = $coll['annotation']->toArray();
|
||||
unset($annotationArray['parsedResponseMap']);
|
||||
|
||||
$array[$coll['resource']][] = $annotationArray;
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
@ -139,7 +139,7 @@
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if data.response is defined and data.response is not empty %}
|
||||
{% if data.parsedResponseMap is defined and data.parsedResponseMap is not empty %}
|
||||
<h4>Return</h4>
|
||||
<table class='fullwidth'>
|
||||
<thead>
|
||||
@ -150,8 +150,19 @@
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for status_code, response in data.parsedResponseMap %}
|
||||
<tbody>
|
||||
{% for name, infos in data.response %}
|
||||
<tr>
|
||||
<td>
|
||||
<h4>
|
||||
{{ status_code }}
|
||||
{% if data.statusCodes[status_code] is defined %}
|
||||
- {{ data.statusCodes[status_code]|join(', ') }}
|
||||
{% endif %}
|
||||
</h4>
|
||||
</td>
|
||||
</tr>
|
||||
{% for name, infos in response.model %}
|
||||
<tr>
|
||||
<td>{{ name }}</td>
|
||||
<td>{{ infos.dataType }}</td>
|
||||
@ -160,6 +171,7 @@
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user