2012-04-13 14:27:51 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the NelmioApiDocBundle.
|
|
|
|
*
|
|
|
|
* (c) Nelmio <hello@nelm.io>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Nelmio\ApiDocBundle\Tests\Formatter;
|
|
|
|
|
|
|
|
use Nelmio\ApiDocBundle\Tests\WebTestCase;
|
|
|
|
|
|
|
|
class MarkdownFormatterTest extends WebTestCase
|
|
|
|
{
|
|
|
|
public function testFormat()
|
|
|
|
{
|
|
|
|
$container = $this->getContainer();
|
|
|
|
|
|
|
|
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
2013-02-15 13:33:05 +01:00
|
|
|
set_error_handler(array($this, 'handleDeprecation'));
|
2012-04-13 14:27:51 +02:00
|
|
|
$data = $extractor->all();
|
2013-02-11 14:42:17 +01:00
|
|
|
restore_error_handler();
|
2012-04-13 14:27:51 +02:00
|
|
|
$result = $container->get('nelmio_api_doc.formatter.markdown_formatter')->format($data);
|
|
|
|
|
|
|
|
$expected = <<<MARKDOWN
|
2014-06-17 17:05:00 -07:00
|
|
|
## /api/other-resources ##
|
|
|
|
|
|
|
|
### `GET` /api/other-resources.{_format} ###
|
|
|
|
|
|
|
|
_List another resource._
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
- Requirement: json|xml|html
|
|
|
|
|
|
|
|
|
|
|
|
### `PUT|PATCH` /api/other-resources/{id}.{_format} ###
|
|
|
|
|
|
|
|
_Update a resource bu ID._
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
- Requirement: json|xml|html
|
|
|
|
**id**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## /api/resources ##
|
|
|
|
|
|
|
|
### `GET` /api/resources.{_format} ###
|
|
|
|
|
|
|
|
_List resources._
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
- Requirement: json|xml|html
|
|
|
|
|
|
|
|
|
|
|
|
### `POST` /api/resources.{_format} ###
|
|
|
|
|
|
|
|
_Create a new resource._
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
- Requirement: json|xml|html
|
|
|
|
|
|
|
|
#### Parameters ####
|
|
|
|
|
|
|
|
a:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* description: Something that describes A.
|
|
|
|
|
|
|
|
b:
|
|
|
|
|
|
|
|
* type: float
|
|
|
|
* required: true
|
|
|
|
|
|
|
|
c:
|
|
|
|
|
|
|
|
* type: choice
|
|
|
|
* required: true
|
|
|
|
|
|
|
|
d:
|
|
|
|
|
|
|
|
* type: datetime
|
|
|
|
* required: true
|
|
|
|
|
|
|
|
e:
|
|
|
|
|
|
|
|
* type: date
|
|
|
|
* required: true
|
|
|
|
|
|
|
|
g:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
|
|
|
|
#### Response ####
|
|
|
|
|
|
|
|
foo:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
bar:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
baz[]:
|
|
|
|
|
|
|
|
* type: array of integers
|
|
|
|
* description: Epic description.
|
|
|
|
|
|
|
|
With multiple lines.
|
|
|
|
|
|
|
|
circular:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
|
|
|
|
circular[foo]:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
circular[bar]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
circular[baz][]:
|
|
|
|
|
|
|
|
* type: array of integers
|
|
|
|
* description: Epic description.
|
|
|
|
|
|
|
|
With multiple lines.
|
|
|
|
|
|
|
|
circular[circular]:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
|
|
|
|
circular[parent]:
|
|
|
|
|
|
|
|
* type: object (JmsTest)
|
|
|
|
|
|
|
|
circular[parent][foo]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
circular[parent][bar]:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
circular[parent][number]:
|
|
|
|
|
|
|
|
* type: double
|
|
|
|
|
|
|
|
circular[parent][arr]:
|
|
|
|
|
|
|
|
* type: array
|
|
|
|
|
|
|
|
circular[parent][nested]:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
|
|
|
|
circular[parent][nested_array][]:
|
|
|
|
|
|
|
|
* type: array of objects (JmsNested)
|
|
|
|
|
|
|
|
circular[since]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: >=0.2
|
|
|
|
|
|
|
|
circular[until]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: <=0.3
|
|
|
|
|
|
|
|
circular[since_and_until]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: >=0.4,<=0.5
|
|
|
|
|
|
|
|
parent:
|
|
|
|
|
|
|
|
* type: object (JmsTest)
|
|
|
|
|
|
|
|
parent[foo]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
parent[bar]:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
parent[number]:
|
|
|
|
|
|
|
|
* type: double
|
|
|
|
|
|
|
|
parent[arr]:
|
|
|
|
|
|
|
|
* type: array
|
|
|
|
|
|
|
|
parent[nested]:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
|
|
|
|
parent[nested_array][]:
|
|
|
|
|
|
|
|
* type: array of objects (JmsNested)
|
|
|
|
|
|
|
|
since:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: >=0.2
|
|
|
|
|
|
|
|
until:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: <=0.3
|
|
|
|
|
|
|
|
since_and_until:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: >=0.4,<=0.5
|
|
|
|
|
|
|
|
|
|
|
|
### `GET` /api/resources/{id}.{_format} ###
|
|
|
|
|
|
|
|
_Retrieve a resource by ID._
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
- Requirement: json|xml|html
|
|
|
|
**id**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### `DELETE` /api/resources/{id}.{_format} ###
|
|
|
|
|
|
|
|
_Delete a resource by ID._
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
- Requirement: json|xml|html
|
|
|
|
**id**
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-17 16:40:31 +01:00
|
|
|
## /tests ##
|
2012-04-13 14:27:51 +02:00
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
### `GET` /tests.{_format} ###
|
2012-04-13 14:27:51 +02:00
|
|
|
|
|
|
|
_index action_
|
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
|
2012-04-13 14:27:51 +02:00
|
|
|
#### Filters ####
|
|
|
|
|
|
|
|
a:
|
|
|
|
|
2012-07-20 02:02:45 +02:00
|
|
|
* DataType: integer
|
2012-04-13 14:27:51 +02:00
|
|
|
|
|
|
|
b:
|
|
|
|
|
2012-07-20 02:02:45 +02:00
|
|
|
* DataType: string
|
|
|
|
* Arbitrary: ["arg1","arg2"]
|
2012-04-13 14:27:51 +02:00
|
|
|
|
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
### `GET` /tests.{_format} ###
|
2012-04-14 10:11:52 +02:00
|
|
|
|
|
|
|
_index action_
|
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
|
2012-04-14 10:11:52 +02:00
|
|
|
#### Filters ####
|
|
|
|
|
|
|
|
a:
|
|
|
|
|
2012-07-20 02:02:45 +02:00
|
|
|
* DataType: integer
|
2012-04-14 10:11:52 +02:00
|
|
|
|
|
|
|
b:
|
|
|
|
|
2012-07-20 02:02:45 +02:00
|
|
|
* DataType: string
|
|
|
|
* Arbitrary: ["arg1","arg2"]
|
2012-04-14 10:11:52 +02:00
|
|
|
|
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
### `POST` /tests.{_format} ###
|
2012-04-14 10:11:52 +02:00
|
|
|
|
|
|
|
_create test_
|
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
|
2012-04-14 10:11:52 +02:00
|
|
|
#### Parameters ####
|
|
|
|
|
2013-07-05 00:27:42 +02:00
|
|
|
a:
|
2012-04-14 10:11:52 +02:00
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* description: A nice description
|
|
|
|
|
2013-07-05 00:27:42 +02:00
|
|
|
b:
|
2012-04-14 10:11:52 +02:00
|
|
|
|
|
|
|
* type: string
|
2012-06-20 23:19:34 +02:00
|
|
|
* required: false
|
2012-05-23 00:20:03 +02:00
|
|
|
|
2013-07-05 00:27:42 +02:00
|
|
|
c:
|
2012-07-12 12:13:24 +02:00
|
|
|
|
|
|
|
* type: boolean
|
|
|
|
* required: true
|
|
|
|
|
2014-06-17 03:15:55 -04:00
|
|
|
d:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* default value: DefaultTest
|
|
|
|
|
2012-04-14 10:11:52 +02:00
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
### `POST` /tests.{_format} ###
|
2012-04-13 14:27:51 +02:00
|
|
|
|
|
|
|
_create test_
|
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
|
2012-04-13 14:27:51 +02:00
|
|
|
#### Parameters ####
|
|
|
|
|
2013-07-05 00:27:42 +02:00
|
|
|
a:
|
2012-04-13 14:27:51 +02:00
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* description: A nice description
|
|
|
|
|
2013-07-05 00:27:42 +02:00
|
|
|
b:
|
2012-04-13 14:27:51 +02:00
|
|
|
|
|
|
|
* type: string
|
2012-06-20 23:19:34 +02:00
|
|
|
* required: false
|
2012-05-23 00:20:03 +02:00
|
|
|
|
2013-07-05 00:27:42 +02:00
|
|
|
c:
|
2012-07-12 12:13:24 +02:00
|
|
|
|
|
|
|
* type: boolean
|
|
|
|
* required: true
|
|
|
|
|
2014-06-17 03:15:55 -04:00
|
|
|
d:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* default value: DefaultTest
|
|
|
|
|
2012-04-13 15:00:46 +02:00
|
|
|
|
2013-03-21 12:15:44 +01:00
|
|
|
## /tests2 ##
|
|
|
|
|
|
|
|
### `POST` /tests2.{_format} ###
|
|
|
|
|
|
|
|
_post test 2_
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 16:18:02 +02:00
|
|
|
## TestResource ##
|
|
|
|
|
|
|
|
### `ANY` /named-resource ###
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-21 00:12:21 +02:00
|
|
|
### `POST` /another-post ###
|
|
|
|
|
|
|
|
_create another test_
|
|
|
|
|
|
|
|
#### Parameters ####
|
|
|
|
|
2014-06-17 17:05:00 -07:00
|
|
|
dependency_type:
|
|
|
|
|
|
|
|
* type: object (dependency_type)
|
|
|
|
* required: true
|
|
|
|
|
2013-04-30 16:19:00 +02:00
|
|
|
dependency_type[a]:
|
2012-06-21 00:12:21 +02:00
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* description: A nice description
|
|
|
|
|
|
|
|
|
2012-04-14 10:11:52 +02:00
|
|
|
### `ANY` /any ###
|
|
|
|
|
|
|
|
_Action without HTTP verb_
|
|
|
|
|
|
|
|
|
2012-04-19 20:27:27 +02:00
|
|
|
### `ANY` /any/{foo} ###
|
2012-04-13 15:00:46 +02:00
|
|
|
|
|
|
|
_Action without HTTP verb_
|
2012-04-19 17:05:59 +02:00
|
|
|
|
2012-04-19 20:27:27 +02:00
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**foo**
|
|
|
|
|
|
|
|
|
2012-04-19 17:05:59 +02:00
|
|
|
|
2013-03-16 18:45:41 +01:00
|
|
|
### `ANY` /authenticated ###
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-07 17:50:58 -04:00
|
|
|
### `POST` /jms-input-test ###
|
|
|
|
|
|
|
|
_Testing JMS_
|
|
|
|
|
2012-08-07 21:47:33 -04:00
|
|
|
#### Parameters ####
|
|
|
|
|
|
|
|
foo:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: false
|
|
|
|
|
|
|
|
number:
|
|
|
|
|
|
|
|
* type: double
|
|
|
|
* required: false
|
|
|
|
|
|
|
|
arr:
|
|
|
|
|
|
|
|
* type: array
|
|
|
|
* required: false
|
|
|
|
|
2012-08-24 11:10:25 -04:00
|
|
|
nested:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
* required: false
|
|
|
|
|
2012-08-31 11:56:48 -04:00
|
|
|
nested[bar]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: false
|
2014-06-26 12:27:47 -07:00
|
|
|
* default value: baz
|
2012-08-31 11:56:48 -04:00
|
|
|
|
|
|
|
nested[baz][]:
|
|
|
|
|
|
|
|
* type: array of integers
|
|
|
|
* required: false
|
|
|
|
* description: Epic description.
|
|
|
|
|
|
|
|
With multiple lines.
|
|
|
|
|
2012-12-20 10:12:50 +01:00
|
|
|
nested[circular]:
|
2012-08-24 11:10:25 -04:00
|
|
|
|
2012-12-20 10:12:50 +01:00
|
|
|
* type: object (JmsNested)
|
|
|
|
* required: false
|
|
|
|
|
|
|
|
nested[parent]:
|
|
|
|
|
|
|
|
* type: object (JmsTest)
|
2012-08-24 11:10:25 -04:00
|
|
|
* required: false
|
|
|
|
|
2012-12-20 10:12:50 +01:00
|
|
|
nested[parent][foo]:
|
2012-08-31 11:56:48 -04:00
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: false
|
|
|
|
|
2012-12-20 10:12:50 +01:00
|
|
|
nested[parent][number]:
|
2012-08-31 11:56:48 -04:00
|
|
|
|
2012-12-20 10:12:50 +01:00
|
|
|
* type: double
|
2012-08-31 11:56:48 -04:00
|
|
|
* required: false
|
|
|
|
|
2012-12-20 10:12:50 +01:00
|
|
|
nested[parent][arr]:
|
|
|
|
|
|
|
|
* type: array
|
|
|
|
* required: false
|
|
|
|
|
|
|
|
nested[parent][nested]:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
* required: false
|
|
|
|
|
2013-03-26 10:37:33 -07:00
|
|
|
nested[parent][nested_array][]:
|
2012-12-20 10:12:50 +01:00
|
|
|
|
|
|
|
* type: array of objects (JmsNested)
|
|
|
|
* required: false
|
|
|
|
|
2013-04-24 22:28:46 +02:00
|
|
|
nested[since]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: false
|
|
|
|
|
|
|
|
nested[until]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: false
|
|
|
|
|
|
|
|
nested[since_and_until]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: false
|
|
|
|
|
2013-03-26 10:37:33 -07:00
|
|
|
nested_array[]:
|
2012-12-20 10:12:50 +01:00
|
|
|
|
|
|
|
* type: array of objects (JmsNested)
|
|
|
|
* required: false
|
2012-08-31 11:56:48 -04:00
|
|
|
|
2012-08-07 17:50:58 -04:00
|
|
|
|
2012-08-27 13:25:03 -04:00
|
|
|
### `GET` /jms-return-test ###
|
|
|
|
|
|
|
|
_Testing return_
|
|
|
|
|
|
|
|
#### Response ####
|
|
|
|
|
2014-06-17 17:05:00 -07:00
|
|
|
dependency_type:
|
|
|
|
|
|
|
|
* type: object (dependency_type)
|
|
|
|
|
2013-04-30 16:19:00 +02:00
|
|
|
dependency_type[a]:
|
2012-08-27 13:25:03 -04:00
|
|
|
|
|
|
|
* type: string
|
|
|
|
* description: A nice description
|
|
|
|
|
|
|
|
|
2013-05-03 14:49:17 +01:00
|
|
|
### `ANY` /my-commented/{id}/{page}/{paramType}/{param} ###
|
2012-04-19 17:05:59 +02:00
|
|
|
|
2012-07-13 16:04:29 +02:00
|
|
|
_This method is useful to test if the getDocComment works._
|
2012-04-19 20:27:27 +02:00
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**id**
|
|
|
|
|
|
|
|
- Type: int
|
|
|
|
- Description: A nice comment
|
2012-05-07 12:51:22 +02:00
|
|
|
**page**
|
|
|
|
|
|
|
|
- Type: int
|
2013-05-03 14:49:17 +01:00
|
|
|
**paramType**
|
|
|
|
|
|
|
|
- Type: int
|
|
|
|
- Description: The param type
|
|
|
|
**param**
|
|
|
|
|
|
|
|
- Type: int
|
|
|
|
- Description: The param id
|
2012-04-19 20:27:27 +02:00
|
|
|
|
|
|
|
|
2013-04-24 22:28:46 +02:00
|
|
|
### `ANY` /return-nested-output ###
|
|
|
|
|
|
|
|
|
|
|
|
#### Response ####
|
|
|
|
|
|
|
|
foo:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
bar:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
number:
|
|
|
|
|
|
|
|
* type: double
|
|
|
|
|
|
|
|
arr:
|
|
|
|
|
|
|
|
* type: array
|
|
|
|
|
|
|
|
nested:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
|
|
|
|
nested[foo]:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
nested[bar]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
nested[baz][]:
|
|
|
|
|
|
|
|
* type: array of integers
|
|
|
|
* description: Epic description.
|
|
|
|
|
|
|
|
With multiple lines.
|
|
|
|
|
|
|
|
nested[circular]:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
|
|
|
|
nested[parent]:
|
|
|
|
|
|
|
|
* type: object (JmsTest)
|
|
|
|
|
|
|
|
nested[parent][foo]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
nested[parent][bar]:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
nested[parent][number]:
|
|
|
|
|
|
|
|
* type: double
|
|
|
|
|
|
|
|
nested[parent][arr]:
|
|
|
|
|
|
|
|
* type: array
|
|
|
|
|
|
|
|
nested[parent][nested]:
|
|
|
|
|
|
|
|
* type: object (JmsNested)
|
|
|
|
|
|
|
|
nested[parent][nested_array][]:
|
|
|
|
|
|
|
|
* type: array of objects (JmsNested)
|
|
|
|
|
|
|
|
nested[since]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: >=0.2
|
|
|
|
|
|
|
|
nested[until]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: <=0.3
|
|
|
|
|
|
|
|
nested[since_and_until]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* versions: >=0.4,<=0.5
|
|
|
|
|
|
|
|
nested_array[]:
|
|
|
|
|
|
|
|
* type: array of objects (JmsNested)
|
|
|
|
|
|
|
|
|
2012-12-10 10:21:04 -08:00
|
|
|
### `ANY` /secure-route ###
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-04-19 20:27:27 +02:00
|
|
|
### `ANY` /yet-another/{id} ###
|
|
|
|
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**id**
|
|
|
|
|
2014-06-17 17:05:00 -07:00
|
|
|
- Requirement: \d+
|
2012-07-20 00:58:58 +02:00
|
|
|
|
|
|
|
|
2013-05-09 23:59:03 -03:00
|
|
|
### `GET` /z-action-with-deprecated-indicator ###
|
2013-03-18 08:40:03 +01:00
|
|
|
### This method is deprecated ###
|
|
|
|
|
2012-07-20 00:58:58 +02:00
|
|
|
|
|
|
|
|
2013-05-09 23:59:03 -03:00
|
|
|
|
2014-06-18 11:50:26 +02:00
|
|
|
### `POST` /z-action-with-nullable-request-param ###
|
|
|
|
|
|
|
|
|
|
|
|
#### Parameters ####
|
|
|
|
|
|
|
|
param1:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: false
|
|
|
|
* description: Param1 description.
|
|
|
|
|
|
|
|
|
2013-05-09 23:59:03 -03:00
|
|
|
### `GET` /z-action-with-query-param ###
|
|
|
|
|
|
|
|
|
2012-07-20 00:58:58 +02:00
|
|
|
#### Filters ####
|
|
|
|
|
|
|
|
page:
|
|
|
|
|
2014-06-17 17:05:00 -07:00
|
|
|
* Requirement: \d+
|
2012-07-20 02:02:45 +02:00
|
|
|
* Description: Page of the overview.
|
2013-04-30 16:21:12 +04:00
|
|
|
* Default: 1
|
|
|
|
|
|
|
|
|
|
|
|
### `GET` /z-action-with-query-param-no-default ###
|
|
|
|
|
|
|
|
|
|
|
|
#### Filters ####
|
|
|
|
|
|
|
|
page:
|
|
|
|
|
|
|
|
* Requirement: \d+
|
|
|
|
* Description: Page of the overview.
|
|
|
|
|
|
|
|
|
|
|
|
### `GET` /z-action-with-query-param-strict ###
|
|
|
|
|
|
|
|
|
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**page**
|
|
|
|
|
|
|
|
- Requirement: \d+
|
|
|
|
- Description: Page of the overview.
|
2012-11-14 23:59:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
### `POST` /z-action-with-request-param ###
|
|
|
|
|
|
|
|
|
|
|
|
#### Parameters ####
|
|
|
|
|
|
|
|
param1:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* description: Param1 description.
|
2013-11-07 13:30:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
### `ANY` /z-return-jms-and-validator-output ###
|
|
|
|
|
|
|
|
|
2013-12-05 00:05:47 +01:00
|
|
|
#### Response ####
|
|
|
|
|
|
|
|
bar:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
objects[]:
|
|
|
|
|
|
|
|
* type: array of objects (Test)
|
|
|
|
|
|
|
|
objects[][a]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
objects[][b]:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
|
|
|
number:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
2013-11-07 16:17:23 +01:00
|
|
|
related:
|
|
|
|
|
|
|
|
* type: object (Test)
|
|
|
|
|
2013-12-05 00:05:47 +01:00
|
|
|
|
|
|
|
### `ANY` /z-return-selected-parsers-input ###
|
|
|
|
|
|
|
|
|
|
|
|
#### Parameters ####
|
|
|
|
|
|
|
|
a:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* description: A nice description
|
|
|
|
|
|
|
|
b:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: false
|
|
|
|
|
|
|
|
c:
|
|
|
|
|
|
|
|
* type: boolean
|
|
|
|
* required: true
|
|
|
|
|
2014-06-17 03:15:55 -04:00
|
|
|
d:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
* required: true
|
|
|
|
* default value: DefaultTest
|
|
|
|
|
2013-12-05 00:05:47 +01:00
|
|
|
|
|
|
|
### `ANY` /z-return-selected-parsers-output ###
|
|
|
|
|
|
|
|
|
2013-11-07 13:30:13 +01:00
|
|
|
#### Response ####
|
|
|
|
|
|
|
|
bar:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
2013-11-07 14:11:09 +01:00
|
|
|
objects[]:
|
|
|
|
|
|
|
|
* type: array of objects (Test)
|
|
|
|
|
|
|
|
objects[][a]:
|
|
|
|
|
|
|
|
* type: string
|
|
|
|
|
|
|
|
objects[][b]:
|
|
|
|
|
|
|
|
* type: DateTime
|
|
|
|
|
2013-11-07 13:30:13 +01:00
|
|
|
number:
|
|
|
|
|
|
|
|
* type: DateTime
|
2013-11-07 16:17:23 +01:00
|
|
|
|
|
|
|
related:
|
|
|
|
|
|
|
|
* type: object (Test)
|
2012-04-13 15:00:46 +02:00
|
|
|
MARKDOWN;
|
|
|
|
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testFormatOne()
|
|
|
|
{
|
|
|
|
$container = $this->getContainer();
|
|
|
|
|
2012-07-20 00:58:58 +02:00
|
|
|
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
|
|
|
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::indexAction', 'test_route_1');
|
|
|
|
$result = $container->get('nelmio_api_doc.formatter.markdown_formatter')->formatOne($annotation);
|
2012-04-13 15:00:46 +02:00
|
|
|
|
|
|
|
$expected = <<<MARKDOWN
|
2012-08-10 11:38:01 +02:00
|
|
|
### `GET` /tests.{_format} ###
|
2012-04-13 15:00:46 +02:00
|
|
|
|
|
|
|
_index action_
|
|
|
|
|
2012-08-10 11:38:01 +02:00
|
|
|
#### Requirements ####
|
|
|
|
|
|
|
|
**_format**
|
|
|
|
|
|
|
|
|
2012-04-13 15:00:46 +02:00
|
|
|
#### Filters ####
|
|
|
|
|
|
|
|
a:
|
|
|
|
|
2012-07-20 02:02:45 +02:00
|
|
|
* DataType: integer
|
2012-04-13 15:00:46 +02:00
|
|
|
|
|
|
|
b:
|
|
|
|
|
2012-07-20 02:02:45 +02:00
|
|
|
* DataType: string
|
|
|
|
* Arbitrary: ["arg1","arg2"]
|
2012-04-13 15:00:46 +02:00
|
|
|
|
|
|
|
|
2012-04-13 14:27:51 +02:00
|
|
|
MARKDOWN;
|
|
|
|
|
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
}
|
|
|
|
}
|