mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
[Formatter] Fixed MarkdownFormatter.
This commit is contained in:
parent
5daf8ac5f6
commit
67db76990e
@ -123,13 +123,15 @@ class MarkdownFormatter extends AbstractFormatter
|
|||||||
{
|
{
|
||||||
if ('_others' !== $section) {
|
if ('_others' !== $section) {
|
||||||
$markdown = sprintf("# %s #\n\n", $section);
|
$markdown = sprintf("# %s #\n\n", $section);
|
||||||
|
} else {
|
||||||
|
$markdown = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($resources as $resource => $methods) {
|
foreach ($resources as $resource => $methods) {
|
||||||
if ('_others' === $section && 'others' !== $resource) {
|
if ('_others' === $section && 'others' !== $resource) {
|
||||||
$markdown = sprintf("## %s ##\n\n", $resource);
|
$markdown .= sprintf("## %s ##\n\n", $resource);
|
||||||
} elseif ('others' !== $resource) {
|
} elseif ('others' !== $resource) {
|
||||||
$markdown = sprintf("## %s ##\n\n", $resource);
|
$markdown .= sprintf("## %s ##\n\n", $resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
|
@ -24,7 +24,7 @@ class ApiDocExtractorTest extends WebTestCase
|
|||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
|
||||||
$this->assertTrue(is_array($data));
|
$this->assertTrue(is_array($data));
|
||||||
$this->assertCount(15, $data);
|
$this->assertCount(16, $data);
|
||||||
|
|
||||||
foreach ($data as $d) {
|
foreach ($data as $d) {
|
||||||
$this->assertTrue(is_array($d));
|
$this->assertTrue(is_array($d));
|
||||||
@ -64,7 +64,7 @@ class ApiDocExtractorTest extends WebTestCase
|
|||||||
$this->assertFalse(isset($array2['filters']));
|
$this->assertFalse(isset($array2['filters']));
|
||||||
$this->assertEquals('Nelmio\ApiDocBundle\Tests\Fixtures\Form\TestType', $a2->getInput());
|
$this->assertEquals('Nelmio\ApiDocBundle\Tests\Fixtures\Form\TestType', $a2->getInput());
|
||||||
|
|
||||||
$a3 = $data['11']['annotation'];
|
$a3 = $data['12']['annotation'];
|
||||||
$this->assertTrue($a3->getHttps());
|
$this->assertTrue($a3->getHttps());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,16 @@ class TestController
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ApiDoc(
|
||||||
|
* description="post test 2",
|
||||||
|
* resource=true
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function postTest2Action()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public function anotherAction()
|
public function anotherAction()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -91,3 +91,9 @@ test_service_route_4:
|
|||||||
NelmioApiDocBundle:
|
NelmioApiDocBundle:
|
||||||
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
|
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
|
||||||
prefix: /
|
prefix: /
|
||||||
|
|
||||||
|
test_route_14:
|
||||||
|
pattern: /tests2.{_format}
|
||||||
|
defaults: { _controller: NelmioApiDocTestBundle:Test:postTest2, _format: json }
|
||||||
|
requirements:
|
||||||
|
_method: POST
|
||||||
|
@ -126,6 +126,18 @@ c:
|
|||||||
* required: true
|
* required: true
|
||||||
|
|
||||||
|
|
||||||
|
## /tests2 ##
|
||||||
|
|
||||||
|
### `POST` /tests2.{_format} ###
|
||||||
|
|
||||||
|
_post test 2_
|
||||||
|
|
||||||
|
#### Requirements ####
|
||||||
|
|
||||||
|
**_format**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### `POST` /another-post ###
|
### `POST` /another-post ###
|
||||||
|
|
||||||
_create another test_
|
_create another test_
|
||||||
|
@ -477,6 +477,26 @@ And, it supports multilines until the first \'@\' char.',
|
|||||||
'authentication' => false,
|
'authentication' => false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'/tests2' =>
|
||||||
|
array (
|
||||||
|
0 =>
|
||||||
|
array (
|
||||||
|
'method' => 'POST',
|
||||||
|
'uri' => '/tests2.{_format}',
|
||||||
|
'description' => 'post test 2',
|
||||||
|
'requirements' =>
|
||||||
|
array (
|
||||||
|
'_format' =>
|
||||||
|
array (
|
||||||
|
'requirement' => '',
|
||||||
|
'dataType' => '',
|
||||||
|
'description' => '',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'https' => false,
|
||||||
|
'authentication' => false,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user