mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Merge pull request #179 from lightglitch/fix-178
Fix parameter name boundary in regex
This commit is contained in:
commit
5567f74692
@ -323,7 +323,7 @@ class ApiDocExtractor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$regexp = '{(\w*) *\$%s *(.*)}i';
|
$regexp = '{(\w*) *\$%s\b *(.*)}i';
|
||||||
foreach ($route->compile()->getVariables() as $var) {
|
foreach ($route->compile()->getVariables() as $var) {
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($paramDocs as $paramDoc) {
|
foreach ($paramDocs as $paramDoc) {
|
||||||
|
@ -153,6 +153,20 @@ class ApiDocExtractorTest extends WebTestCase
|
|||||||
"This method is useful to test if the getDocComment works.",
|
"This method is useful to test if the getDocComment works.",
|
||||||
$annotation->getDescription()
|
$annotation->getDescription()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$data = $annotation->toArray();
|
||||||
|
$this->assertEquals(
|
||||||
|
4,
|
||||||
|
count($data['requirements'])
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
'The param type',
|
||||||
|
$data['requirements']['paramType']['description']
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
'The param id',
|
||||||
|
$data['requirements']['param']['description']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetWithAuthentication()
|
public function testGetWithAuthentication()
|
||||||
|
@ -73,6 +73,8 @@ class TestController
|
|||||||
*
|
*
|
||||||
* @param int $id A nice comment
|
* @param int $id A nice comment
|
||||||
* @param int $page
|
* @param int $page
|
||||||
|
* @param int $paramType The param type
|
||||||
|
* @param int $param The param id
|
||||||
*/
|
*/
|
||||||
public function myCommentedAction()
|
public function myCommentedAction()
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ test_route_4:
|
|||||||
defaults: { _controller: NelmioApiDocTestBundle:Test:any, _format: json }
|
defaults: { _controller: NelmioApiDocTestBundle:Test:any, _format: json }
|
||||||
|
|
||||||
test_route_5:
|
test_route_5:
|
||||||
pattern: /my-commented/{id}/{page}
|
pattern: /my-commented/{id}/{page}/{paramType}/{param}
|
||||||
defaults: { _controller: NelmioApiDocTestBundle:Test:myCommented }
|
defaults: { _controller: NelmioApiDocTestBundle:Test:myCommented }
|
||||||
|
|
||||||
test_route_6:
|
test_route_6:
|
||||||
|
@ -297,7 +297,7 @@ dependency_type[a]:
|
|||||||
* description: A nice description
|
* description: A nice description
|
||||||
|
|
||||||
|
|
||||||
### `ANY` /my-commented/{id}/{page} ###
|
### `ANY` /my-commented/{id}/{page}/{paramType}/{param} ###
|
||||||
### This method is deprecated ###
|
### This method is deprecated ###
|
||||||
|
|
||||||
|
|
||||||
@ -312,6 +312,14 @@ _This method is useful to test if the getDocComment works._
|
|||||||
**page**
|
**page**
|
||||||
|
|
||||||
- Type: int
|
- Type: int
|
||||||
|
**paramType**
|
||||||
|
|
||||||
|
- Type: int
|
||||||
|
- Description: The param type
|
||||||
|
**param**
|
||||||
|
|
||||||
|
- Type: int
|
||||||
|
- Description: The param id
|
||||||
|
|
||||||
|
|
||||||
### `ANY` /secure-route ###
|
### `ANY` /secure-route ###
|
||||||
|
@ -400,7 +400,7 @@ With multiple lines.',
|
|||||||
6 =>
|
6 =>
|
||||||
array(
|
array(
|
||||||
'method' => 'ANY',
|
'method' => 'ANY',
|
||||||
'uri' => '/my-commented/{id}/{page}',
|
'uri' => '/my-commented/{id}/{page}/{paramType}/{param}',
|
||||||
'description' => 'This method is useful to test if the getDocComment works.',
|
'description' => 'This method is useful to test if the getDocComment works.',
|
||||||
'documentation' => 'This method is useful to test if the getDocComment works.
|
'documentation' => 'This method is useful to test if the getDocComment works.
|
||||||
And, it supports multilines until the first \'@\' char.',
|
And, it supports multilines until the first \'@\' char.',
|
||||||
@ -418,6 +418,18 @@ And, it supports multilines until the first \'@\' char.',
|
|||||||
'description' => '',
|
'description' => '',
|
||||||
'requirement' => '',
|
'requirement' => '',
|
||||||
),
|
),
|
||||||
|
'paramType' =>
|
||||||
|
array (
|
||||||
|
'dataType' => 'int',
|
||||||
|
'description' => 'The param type',
|
||||||
|
'requirement' => '',
|
||||||
|
),
|
||||||
|
'param' =>
|
||||||
|
array (
|
||||||
|
'dataType' => 'int',
|
||||||
|
'description' => 'The param id',
|
||||||
|
'requirement' => '',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'https' => false,
|
'https' => false,
|
||||||
'description' => 'This method is useful to test if the getDocComment works.',
|
'description' => 'This method is useful to test if the getDocComment works.',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user