updated documentation to reflect return property, updated markdown formatter tests to reflect parameter readonly property

This commit is contained in:
Evan Villemez 2012-08-28 16:43:47 -04:00
parent d6c50427aa
commit 0d7c2272bc
4 changed files with 47 additions and 0 deletions

@ -76,6 +76,7 @@ class MarkdownFormatter extends AbstractFormatter
$markdown .= sprintf("%s:\n\n", $name);
$markdown .= sprintf(" * type: %s\n", $parameter['dataType']);
$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'])) {
$markdown .= sprintf(" * description: %s\n", $parameter['description']);
@ -92,6 +93,7 @@ class MarkdownFormatter extends AbstractFormatter
$markdown .= sprintf("%s:\n\n", $name);
$markdown .= sprintf(" * type: %s\n", $parameter['dataType']);
$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'])) {
$markdown .= sprintf(" * description: %s\n", $parameter['description']);

@ -83,6 +83,7 @@ class YourController extends Controller
* @ApiDoc(
* description="Create a new Object",
* input="Your\Namespace\Form\Type\YourType"
* return='Your\Namespace\Class'
* )
*/
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
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
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>Type</th>
<th>Required?</th>
<th>Read Only?</th>
<th>Description</th>
</tr>
</thead>
@ -100,6 +101,33 @@
<td>{{ name }}</td>
<td>{{ infos.dataType }}</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>
</tr>
{% endfor %}

@ -83,17 +83,20 @@ a:
* type: string
* required: true
* readonly: false
* description: A nice description
b:
* type: string
* required: false
* readonly: false
c:
* type: boolean
* required: true
* readonly: false
### `POST` /tests.{_format} ###
@ -111,17 +114,20 @@ a:
* type: string
* required: true
* readonly: false
* description: A nice description
b:
* type: string
* required: false
* readonly: false
c:
* type: boolean
* required: true
* readonly: false
@ -137,6 +143,7 @@ a:
* type: string
* required: true
* readonly: false
* description: A nice description
@ -165,36 +172,42 @@ foo:
* type: string
* required: false
* readonly: false
* description: No description.
bar:
* type: DateTime
* required: false
* readonly: true
* description: No description.
number:
* type: double
* required: false
* readonly: false
* description: No description.
arr:
* type: array
* required: false
* readonly: false
* description: No description.
nested:
* type: object (JmsNested)
* required: false
* readonly: false
* description: No description.
nestedArray:
* type: array of objects (JmsNested)
* required: false
* readonly: false
* description: No description.
@ -208,6 +221,7 @@ a:
* type: string
* required: true
* readonly: false
* description: A nice description