mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Use the response map in the html view
This commit is contained in:
parent
5d9c47bbad
commit
7919b24971
@ -675,6 +675,10 @@ class ApiDoc
|
|||||||
$data['response'] = $response;
|
$data['response'] = $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($parsedResponseMap = $this->parsedResponseMap) {
|
||||||
|
$data['parsedResponseMap'] = $parsedResponseMap;
|
||||||
|
}
|
||||||
|
|
||||||
if ($statusCodes = $this->statusCodes) {
|
if ($statusCodes = $this->statusCodes) {
|
||||||
$data['statusCodes'] = $statusCodes;
|
$data['statusCodes'] = $statusCodes;
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,12 @@ abstract class AbstractFormatter implements FormatterInterface
|
|||||||
$annotation['response'] = $this->compressNestedParameters($annotation['response']);
|
$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']);
|
$annotation['id'] = strtolower($annotation['method']).'-'.str_replace('/', '-', $annotation['uri']);
|
||||||
|
|
||||||
return $annotation;
|
return $annotation;
|
||||||
|
@ -30,7 +30,10 @@ class SimpleFormatter extends AbstractFormatter
|
|||||||
{
|
{
|
||||||
$array = array();
|
$array = array();
|
||||||
foreach ($collection as $coll) {
|
foreach ($collection as $coll) {
|
||||||
$array[$coll['resource']][] = $coll['annotation']->toArray();
|
$annotationArray = $coll['annotation']->toArray();
|
||||||
|
unset($annotationArray['parsedResponseMap']);
|
||||||
|
|
||||||
|
$array[$coll['resource']][] = $annotationArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
|
@ -139,27 +139,39 @@
|
|||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% 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>
|
<h4>Return</h4>
|
||||||
<table class='fullwidth'>
|
<table class='fullwidth'>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Parameter</th>
|
<th>Parameter</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Versions</th>
|
<th>Versions</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
{% for status_code, response in data.parsedResponseMap %}
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for name, infos in data.response %}
|
<tr>
|
||||||
<tr>
|
<td>
|
||||||
<td>{{ name }}</td>
|
<h4>
|
||||||
<td>{{ infos.dataType }}</td>
|
{{ status_code }}
|
||||||
<td>{% include 'NelmioApiDocBundle:Components:version.html.twig' with {'sinceVersion': infos.sinceVersion, 'untilVersion': infos.untilVersion} only %}</td>
|
{% if data.statusCodes[status_code] is defined %}
|
||||||
<td>{{ infos.description }}</td>
|
- {{ data.statusCodes[status_code]|join(', ') }}
|
||||||
</tr>
|
{% endif %}
|
||||||
{% endfor %}
|
</h4>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% for name, infos in response.model %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ name }}</td>
|
||||||
|
<td>{{ infos.dataType }}</td>
|
||||||
|
<td>{% include 'NelmioApiDocBundle:Components:version.html.twig' with {'sinceVersion': infos.sinceVersion, 'untilVersion': infos.untilVersion} only %}</td>
|
||||||
|
<td>{{ infos.description }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user