mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
updated documentation to reflect return property, updated markdown formatter tests to reflect parameter readonly property
This commit is contained in:
parent
d6c50427aa
commit
0d7c2272bc
@ -76,6 +76,7 @@ class MarkdownFormatter extends AbstractFormatter
|
|||||||
$markdown .= sprintf("%s:\n\n", $name);
|
$markdown .= sprintf("%s:\n\n", $name);
|
||||||
$markdown .= sprintf(" * type: %s\n", $parameter['dataType']);
|
$markdown .= sprintf(" * type: %s\n", $parameter['dataType']);
|
||||||
$markdown .= sprintf(" * required: %s\n", $parameter['required'] ? 'true' : 'false');
|
$markdown .= sprintf(" * required: %s\n", $parameter['required'] ? 'true' : 'false');
|
||||||
|
$markdown .= sprintf(" * readonly: %s\n", $parameter['readonly'] ? 'true' : 'false');
|
||||||
|
|
||||||
if (isset($parameter['description']) && !empty($parameter['description'])) {
|
if (isset($parameter['description']) && !empty($parameter['description'])) {
|
||||||
$markdown .= sprintf(" * description: %s\n", $parameter['description']);
|
$markdown .= sprintf(" * description: %s\n", $parameter['description']);
|
||||||
@ -92,6 +93,7 @@ class MarkdownFormatter extends AbstractFormatter
|
|||||||
$markdown .= sprintf("%s:\n\n", $name);
|
$markdown .= sprintf("%s:\n\n", $name);
|
||||||
$markdown .= sprintf(" * type: %s\n", $parameter['dataType']);
|
$markdown .= sprintf(" * type: %s\n", $parameter['dataType']);
|
||||||
$markdown .= sprintf(" * required: %s\n", $parameter['required'] ? 'true' : 'false');
|
$markdown .= sprintf(" * required: %s\n", $parameter['required'] ? 'true' : 'false');
|
||||||
|
$markdown .= sprintf(" * readonly: %s\n", $parameter['readonly'] ? 'true' : 'false');
|
||||||
|
|
||||||
if (isset($parameter['description']) && !empty($parameter['description'])) {
|
if (isset($parameter['description']) && !empty($parameter['description'])) {
|
||||||
$markdown .= sprintf(" * description: %s\n", $parameter['description']);
|
$markdown .= sprintf(" * description: %s\n", $parameter['description']);
|
||||||
|
@ -83,6 +83,7 @@ class YourController extends Controller
|
|||||||
* @ApiDoc(
|
* @ApiDoc(
|
||||||
* description="Create a new Object",
|
* description="Create a new Object",
|
||||||
* input="Your\Namespace\Form\Type\YourType"
|
* input="Your\Namespace\Form\Type\YourType"
|
||||||
|
* return='Your\Namespace\Class'
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function postAction()
|
public function postAction()
|
||||||
@ -102,6 +103,8 @@ The following properties are available:
|
|||||||
* `input`: the input type associated to the method, currently this supports Form Types, and classes with JMS Serializer
|
* `input`: the input type associated to the method, currently this supports Form Types, and classes with JMS Serializer
|
||||||
metadata, useful for POST|PUT methods, either as FQCN or as form type (if it is registered in the form factory in the container)
|
metadata, useful for POST|PUT methods, either as FQCN or as form type (if it is registered in the form factory in the container)
|
||||||
|
|
||||||
|
* `return`: the return type associated with the response. Specified and parsed the same way as `input`.
|
||||||
|
|
||||||
Each _filter_ has to define a `name` parameter, but other parameters are free. Filters are often optional
|
Each _filter_ has to define a `name` parameter, but other parameters are free. Filters are often optional
|
||||||
parameters, and you can document them as you want, but keep in mind to be consistent for the whole documentation.
|
parameters, and you can document them as you want, but keep in mind to be consistent for the whole documentation.
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@
|
|||||||
<th>Parameter</th>
|
<th>Parameter</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Required?</th>
|
<th>Required?</th>
|
||||||
|
<th>Read Only?</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -100,6 +101,33 @@
|
|||||||
<td>{{ name }}</td>
|
<td>{{ name }}</td>
|
||||||
<td>{{ infos.dataType }}</td>
|
<td>{{ infos.dataType }}</td>
|
||||||
<td>{{ infos.required ? 'true' : 'false' }}</td>
|
<td>{{ infos.required ? 'true' : 'false' }}</td>
|
||||||
|
<td>{{ infos.readonly }} ? 'true' : 'false'</td>
|
||||||
|
<td>{{ infos.description }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if data.response is defined and data.response is not empty %}
|
||||||
|
<h4>Return</h4>
|
||||||
|
<table class='fullwidth'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Parameter</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Required?</th>
|
||||||
|
<th>Read Only?</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for name, infos in data.response %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ name }}</td>
|
||||||
|
<td>{{ infos.dataType }}</td>
|
||||||
|
<td>{{ infos.required ? 'true' : 'false' }}</td>
|
||||||
|
<td>{{ infos.readonly }} ? 'true' : 'false'</td>
|
||||||
<td>{{ infos.description }}</td>
|
<td>{{ infos.description }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -83,17 +83,20 @@ a:
|
|||||||
|
|
||||||
* type: string
|
* type: string
|
||||||
* required: true
|
* required: true
|
||||||
|
* readonly: false
|
||||||
* description: A nice description
|
* description: A nice description
|
||||||
|
|
||||||
b:
|
b:
|
||||||
|
|
||||||
* type: string
|
* type: string
|
||||||
* required: false
|
* required: false
|
||||||
|
* readonly: false
|
||||||
|
|
||||||
c:
|
c:
|
||||||
|
|
||||||
* type: boolean
|
* type: boolean
|
||||||
* required: true
|
* required: true
|
||||||
|
* readonly: false
|
||||||
|
|
||||||
|
|
||||||
### `POST` /tests.{_format} ###
|
### `POST` /tests.{_format} ###
|
||||||
@ -111,17 +114,20 @@ a:
|
|||||||
|
|
||||||
* type: string
|
* type: string
|
||||||
* required: true
|
* required: true
|
||||||
|
* readonly: false
|
||||||
* description: A nice description
|
* description: A nice description
|
||||||
|
|
||||||
b:
|
b:
|
||||||
|
|
||||||
* type: string
|
* type: string
|
||||||
* required: false
|
* required: false
|
||||||
|
* readonly: false
|
||||||
|
|
||||||
c:
|
c:
|
||||||
|
|
||||||
* type: boolean
|
* type: boolean
|
||||||
* required: true
|
* required: true
|
||||||
|
* readonly: false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -137,6 +143,7 @@ a:
|
|||||||
|
|
||||||
* type: string
|
* type: string
|
||||||
* required: true
|
* required: true
|
||||||
|
* readonly: false
|
||||||
* description: A nice description
|
* description: A nice description
|
||||||
|
|
||||||
|
|
||||||
@ -165,36 +172,42 @@ foo:
|
|||||||
|
|
||||||
* type: string
|
* type: string
|
||||||
* required: false
|
* required: false
|
||||||
|
* readonly: false
|
||||||
* description: No description.
|
* description: No description.
|
||||||
|
|
||||||
bar:
|
bar:
|
||||||
|
|
||||||
* type: DateTime
|
* type: DateTime
|
||||||
* required: false
|
* required: false
|
||||||
|
* readonly: true
|
||||||
* description: No description.
|
* description: No description.
|
||||||
|
|
||||||
number:
|
number:
|
||||||
|
|
||||||
* type: double
|
* type: double
|
||||||
* required: false
|
* required: false
|
||||||
|
* readonly: false
|
||||||
* description: No description.
|
* description: No description.
|
||||||
|
|
||||||
arr:
|
arr:
|
||||||
|
|
||||||
* type: array
|
* type: array
|
||||||
* required: false
|
* required: false
|
||||||
|
* readonly: false
|
||||||
* description: No description.
|
* description: No description.
|
||||||
|
|
||||||
nested:
|
nested:
|
||||||
|
|
||||||
* type: object (JmsNested)
|
* type: object (JmsNested)
|
||||||
* required: false
|
* required: false
|
||||||
|
* readonly: false
|
||||||
* description: No description.
|
* description: No description.
|
||||||
|
|
||||||
nestedArray:
|
nestedArray:
|
||||||
|
|
||||||
* type: array of objects (JmsNested)
|
* type: array of objects (JmsNested)
|
||||||
* required: false
|
* required: false
|
||||||
|
* readonly: false
|
||||||
* description: No description.
|
* description: No description.
|
||||||
|
|
||||||
|
|
||||||
@ -208,6 +221,7 @@ a:
|
|||||||
|
|
||||||
* type: string
|
* type: string
|
||||||
* required: true
|
* required: true
|
||||||
|
* readonly: false
|
||||||
* description: A nice description
|
* description: A nice description
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user