mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Merge pull request #191 from iambrosi/patch-1
Added check for deprecated setting
This commit is contained in:
commit
3e8b896d00
@ -20,7 +20,7 @@ class MarkdownFormatter extends AbstractFormatter
|
||||
{
|
||||
$markdown = sprintf("### `%s` %s ###\n", $data['method'], $data['uri']);
|
||||
|
||||
if(isset($data['deprecated'])) {
|
||||
if(isset($data['deprecated']) && false !== $data['deprecated']) {
|
||||
$markdown .= "### This method is deprecated ###";
|
||||
$markdown .= "\n\n";
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ use Nelmio\ApiDocBundle\Tests\WebTestCase;
|
||||
|
||||
class ApiDocExtractorTest extends WebTestCase
|
||||
{
|
||||
const ROUTES_QUANTITY = 18;
|
||||
const ROUTES_QUANTITY = 19;
|
||||
|
||||
public function testAll()
|
||||
{
|
||||
|
@ -111,3 +111,9 @@ test_route_16:
|
||||
defaults: { _controller: NelmioApiDocTestBundle:Test:zActionWithQueryParamNoDefault }
|
||||
requirements:
|
||||
_method: GET
|
||||
|
||||
test_route_17:
|
||||
pattern: /z-action-with-deprecated-indicator
|
||||
defaults: { _controller: NelmioApiDocTestBundle:Test:deprecated }
|
||||
requirements:
|
||||
_method: GET
|
||||
|
@ -29,8 +29,6 @@ class MarkdownFormatterTest extends WebTestCase
|
||||
## /tests ##
|
||||
|
||||
### `GET` /tests.{_format} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_index action_
|
||||
|
||||
@ -52,8 +50,6 @@ b:
|
||||
|
||||
|
||||
### `GET` /tests.{_format} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_index action_
|
||||
|
||||
@ -75,8 +71,6 @@ b:
|
||||
|
||||
|
||||
### `POST` /tests.{_format} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_create test_
|
||||
|
||||
@ -105,8 +99,6 @@ test_type[c]:
|
||||
|
||||
|
||||
### `POST` /tests.{_format} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_create test_
|
||||
|
||||
@ -137,8 +129,6 @@ test_type[c]:
|
||||
## /tests2 ##
|
||||
|
||||
### `POST` /tests2.{_format} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_post test 2_
|
||||
|
||||
@ -149,8 +139,6 @@ _post test 2_
|
||||
|
||||
|
||||
### `POST` /another-post ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_create another test_
|
||||
|
||||
@ -164,15 +152,11 @@ dependency_type[a]:
|
||||
|
||||
|
||||
### `ANY` /any ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_Action without HTTP verb_
|
||||
|
||||
|
||||
### `ANY` /any/{foo} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_Action without HTTP verb_
|
||||
|
||||
@ -183,14 +167,10 @@ _Action without HTTP verb_
|
||||
|
||||
|
||||
### `ANY` /authenticated ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
|
||||
|
||||
### `POST` /jms-input-test ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_Testing JMS_
|
||||
|
||||
@ -271,8 +251,6 @@ nested_array[]:
|
||||
|
||||
|
||||
### `GET` /jms-return-test ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_Testing return_
|
||||
|
||||
@ -285,8 +263,6 @@ dependency_type[a]:
|
||||
|
||||
|
||||
### `ANY` /my-commented/{id}/{page}/{paramType}/{param} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_This method is useful to test if the getDocComment works._
|
||||
|
||||
@ -310,8 +286,6 @@ _This method is useful to test if the getDocComment works._
|
||||
|
||||
|
||||
### `ANY` /secure-route ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
|
||||
#### Requirements ####
|
||||
@ -322,8 +296,6 @@ _This method is useful to test if the getDocComment works._
|
||||
|
||||
|
||||
### `ANY` /yet-another/{id} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
|
||||
#### Requirements ####
|
||||
@ -333,11 +305,15 @@ _This method is useful to test if the getDocComment works._
|
||||
- Requirement: \\d+
|
||||
|
||||
|
||||
### `GET` /z-action-with-query-param ###
|
||||
### `GET` /z-action-with-deprecated-indicator ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
|
||||
|
||||
### `GET` /z-action-with-query-param ###
|
||||
|
||||
|
||||
#### Filters ####
|
||||
|
||||
page:
|
||||
@ -348,8 +324,6 @@ page:
|
||||
|
||||
|
||||
### `GET` /z-action-with-query-param-no-default ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
|
||||
#### Filters ####
|
||||
@ -361,8 +335,6 @@ page:
|
||||
|
||||
|
||||
### `GET` /z-action-with-query-param-strict ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
|
||||
#### Requirements ####
|
||||
@ -374,8 +346,6 @@ page:
|
||||
|
||||
|
||||
### `POST` /z-action-with-request-param ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
|
||||
#### Parameters ####
|
||||
@ -400,8 +370,6 @@ MARKDOWN;
|
||||
|
||||
$expected = <<<MARKDOWN
|
||||
### `GET` /tests.{_format} ###
|
||||
### This method is deprecated ###
|
||||
|
||||
|
||||
_index action_
|
||||
|
||||
|
@ -472,6 +472,14 @@ And, it supports multilines until the first \'@\' char.',
|
||||
'deprecated' => false,
|
||||
),
|
||||
9 =>
|
||||
array(
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-deprecated-indicator',
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'deprecated' => true,
|
||||
),
|
||||
10 =>
|
||||
array(
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param',
|
||||
@ -488,7 +496,7 @@ And, it supports multilines until the first \'@\' char.',
|
||||
'authentication' => false,
|
||||
'deprecated' => false,
|
||||
),
|
||||
10 =>
|
||||
11 =>
|
||||
array(
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param-no-default',
|
||||
@ -504,7 +512,7 @@ And, it supports multilines until the first \'@\' char.',
|
||||
'authentication' => false,
|
||||
'deprecated' => false,
|
||||
),
|
||||
11 =>
|
||||
12 =>
|
||||
array(
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param-strict',
|
||||
@ -521,7 +529,7 @@ And, it supports multilines until the first \'@\' char.',
|
||||
'authentication' => false,
|
||||
'deprecated' => false,
|
||||
),
|
||||
12 =>
|
||||
13 =>
|
||||
array(
|
||||
'method' => 'POST',
|
||||
'uri' => '/z-action-with-request-param',
|
||||
|
Loading…
x
Reference in New Issue
Block a user