mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 07:41:43 +03:00
Remove the support of fos-rest
This commit is contained in:
parent
73f9b9e8a2
commit
e97eba7c1b
@ -1,125 +0,0 @@
|
||||
<?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\Extractor\Handler;
|
||||
|
||||
use FOS\RestBundle\Controller\Annotations\QueryParam;
|
||||
use FOS\RestBundle\Controller\Annotations\RequestParam;
|
||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||
use Nelmio\ApiDocBundle\DataTypes;
|
||||
use Nelmio\ApiDocBundle\Extractor\HandlerInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\Constraints\Regex;
|
||||
|
||||
class FosRestHandler implements HandlerInterface
|
||||
{
|
||||
public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method): void
|
||||
{
|
||||
foreach ($annotations as $annot) {
|
||||
if ($annot instanceof RequestParam) {
|
||||
$requirements = $this->handleRequirements($annot->requirements);
|
||||
$data = [
|
||||
'required' => $annot->strict && false === $annot->nullable && null === $annot->default,
|
||||
'dataType' => $requirements . ((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''),
|
||||
'actualType' => $this->inferType($requirements),
|
||||
'subType' => null,
|
||||
'description' => $annot->description,
|
||||
'readonly' => false,
|
||||
];
|
||||
if (false === $annot->strict) {
|
||||
$data['default'] = $annot->default;
|
||||
}
|
||||
$annotation->addParameter($annot->name, $data);
|
||||
} elseif ($annot instanceof QueryParam) {
|
||||
if ($annot->strict && false === $annot->nullable && null === $annot->default) {
|
||||
$annotation->addRequirement($annot->name, [
|
||||
'requirement' => $this->handleRequirements($annot->requirements) . ((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''),
|
||||
'dataType' => '',
|
||||
'description' => $annot->description,
|
||||
]);
|
||||
} elseif (null !== $annot->default) {
|
||||
$annotation->addFilter($annot->name, [
|
||||
'requirement' => $this->handleRequirements($annot->requirements) . ((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''),
|
||||
'description' => $annot->description,
|
||||
'default' => $annot->default,
|
||||
]);
|
||||
} elseif (null !== $annot->requirements) {
|
||||
$annotation->addFilter($annot->name, [
|
||||
'requirement' => $this->handleRequirements($annot->requirements) . ((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''),
|
||||
'description' => $annot->description,
|
||||
]);
|
||||
} else {
|
||||
$annotation->addFilter($annot->name, [
|
||||
'description' => $annot->description,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle FOSRestBundle requirements in order to return a string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function handleRequirements($requirements)
|
||||
{
|
||||
if (is_object($requirements) && $requirements instanceof Constraint) {
|
||||
if ($requirements instanceof Regex) {
|
||||
return $requirements->getHtmlPattern();
|
||||
}
|
||||
$class = $requirements::class;
|
||||
|
||||
return substr($class, strrpos($class, '\\') + 1);
|
||||
}
|
||||
|
||||
if (is_array($requirements) && isset($requirements['rule'])) {
|
||||
return (string) $requirements['rule'];
|
||||
}
|
||||
|
||||
if (is_array($requirements) && array_key_exists(0, $requirements)) {
|
||||
$output = [];
|
||||
|
||||
foreach ($requirements as $req) {
|
||||
if (is_object($req) && $req instanceof Constraint) {
|
||||
if ($req instanceof Regex) {
|
||||
$output[] = $req->getHtmlPattern();
|
||||
} else {
|
||||
$class = $req::class;
|
||||
$output[] = substr($class, strrpos($class, '\\') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($req)) {
|
||||
if (array_key_exists('_format', $req)) {
|
||||
$output[] = 'Format: ' . $req['_format'];
|
||||
} elseif (isset($req['rule'])) {
|
||||
$output[] = $req['rule'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return implode(', ', $output);
|
||||
}
|
||||
|
||||
return (string) $requirements;
|
||||
}
|
||||
|
||||
public function inferType($requirement)
|
||||
{
|
||||
if (DataTypes::isPrimitive($requirement)) {
|
||||
return $requirement;
|
||||
}
|
||||
|
||||
return DataTypes::STRING;
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@
|
||||
<parameter key="nelmio_api_doc.twig.extension.extra_markdown.class">Nelmio\ApiDocBundle\Twig\Extension\MarkdownExtension</parameter>
|
||||
<parameter key="nelmio_api_doc.doc_comment_extractor.class">Nelmio\ApiDocBundle\Util\DocCommentExtractor</parameter>
|
||||
|
||||
<parameter key="nelmio_api_doc.extractor.handler.fos_rest.class">Nelmio\ApiDocBundle\Extractor\Handler\FosRestHandler</parameter>
|
||||
<parameter key="nelmio_api_doc.extractor.handler.jms_security.class">Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler</parameter>
|
||||
<parameter key="nelmio_api_doc.extractor.handler.phpdoc.class">Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler</parameter>
|
||||
|
||||
@ -43,10 +42,6 @@
|
||||
|
||||
<!-- Extractor Annotation Handlers -->
|
||||
|
||||
<service id="nelmio_api_doc.extractor.handler.fos_rest" class="%nelmio_api_doc.extractor.handler.fos_rest.class%" public="false">
|
||||
<tag name="nelmio_api_doc.extractor.handler"/>
|
||||
</service>
|
||||
|
||||
<service id="nelmio_api_doc.extractor.handler.jms_security" class="%nelmio_api_doc.extractor.handler.jms_security.class%" public="false">
|
||||
<tag name="nelmio_api_doc.extractor.handler"/>
|
||||
</service>
|
||||
|
@ -1,14 +1,6 @@
|
||||
Other Bundle Annotations
|
||||
========================
|
||||
|
||||
This bundle will get information from the following other annotations:
|
||||
|
||||
* ``@FOS\RestBundle\Controller\Annotations\RequestParam`` - use as ``parameters``
|
||||
* ``@FOS\RestBundle\Controller\Annotations\QueryParam`` - use as ``requirements``
|
||||
(when strict parameter is true), ``filters`` (when strict is false)
|
||||
* ``@JMS\SecurityExtraBundle\Annotation\Secure`` - set ``authentication`` to true,
|
||||
``authenticationRoles`` to the given roles
|
||||
|
||||
PHPDoc
|
||||
------
|
||||
|
||||
|
@ -19,7 +19,7 @@ class ApiDocExtractorTest extends WebTestCase
|
||||
{
|
||||
public const NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE = 5;
|
||||
|
||||
private static $ROUTES_QUANTITY_DEFAULT = 36; // Routes in the default view
|
||||
private static $ROUTES_QUANTITY_DEFAULT = 28; // Routes in the default view
|
||||
private static $ROUTES_QUANTITY_PREMIUM = 5; // Routes in the premium view
|
||||
private static $ROUTES_QUANTITY_TEST = 2; // Routes in the test view
|
||||
|
||||
|
@ -1,205 +0,0 @@
|
||||
<?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\Extractor;
|
||||
|
||||
use Nelmio\ApiDocBundle\Tests\WebTestCase;
|
||||
|
||||
class FosRestHandlerTest extends WebTestCase
|
||||
{
|
||||
public function testGetWithQueryParamStrict(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamStrictAction', 'test_route_15');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
|
||||
$requirements = $annotation->getRequirements();
|
||||
$this->assertCount(1, $requirements);
|
||||
$this->assertArrayHasKey('page', $requirements);
|
||||
|
||||
$requirement = $requirements['page'];
|
||||
|
||||
$this->assertArrayHasKey('requirement', $requirement);
|
||||
$this->assertEquals($requirement['requirement'], '\d+');
|
||||
|
||||
$this->assertArrayHasKey('description', $requirement);
|
||||
$this->assertEquals($requirement['description'], 'Page of the overview.');
|
||||
|
||||
$this->assertArrayHasKey('dataType', $requirement);
|
||||
|
||||
$this->assertArrayNotHasKey('default', $requirement);
|
||||
}
|
||||
|
||||
public function testGetWithQueryParam(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamAction', 'test_route_8');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
|
||||
$filters = $annotation->getFilters();
|
||||
$this->assertCount(1, $filters);
|
||||
$this->assertArrayHasKey('page', $filters);
|
||||
|
||||
$filter = $filters['page'];
|
||||
|
||||
$this->assertArrayHasKey('requirement', $filter);
|
||||
$this->assertEquals($filter['requirement'], '\d+');
|
||||
|
||||
$this->assertArrayHasKey('description', $filter);
|
||||
$this->assertEquals($filter['description'], 'Page of the overview.');
|
||||
|
||||
$this->assertArrayHasKey('default', $filter);
|
||||
$this->assertEquals($filter['default'], '1');
|
||||
}
|
||||
|
||||
public function testGetWithQueryParamNoDefault(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamNoDefaultAction', 'test_route_16');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
|
||||
$filters = $annotation->getFilters();
|
||||
$this->assertCount(1, $filters);
|
||||
$this->assertArrayHasKey('page', $filters);
|
||||
|
||||
$filter = $filters['page'];
|
||||
|
||||
$this->assertArrayHasKey('requirement', $filter);
|
||||
$this->assertEquals($filter['requirement'], '\d+');
|
||||
|
||||
$this->assertArrayHasKey('description', $filter);
|
||||
$this->assertEquals($filter['description'], 'Page of the overview.');
|
||||
|
||||
$this->assertArrayNotHasKey('default', $filter);
|
||||
}
|
||||
|
||||
public function testGetWithConstraintAsRequirements(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithConstraintAsRequirements', 'test_route_21');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
|
||||
$filters = $annotation->getFilters();
|
||||
$this->assertCount(1, $filters);
|
||||
$this->assertArrayHasKey('mail', $filters);
|
||||
|
||||
$filter = $filters['mail'];
|
||||
|
||||
$this->assertArrayHasKey('requirement', $filter);
|
||||
$this->assertEquals($filter['requirement'], 'Email');
|
||||
}
|
||||
|
||||
public function testGetWithRequestParam(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithRequestParamAction', 'test_route_11');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
|
||||
$parameters = $annotation->getParameters();
|
||||
$this->assertCount(1, $parameters);
|
||||
$this->assertArrayHasKey('param1', $parameters);
|
||||
|
||||
$parameter = $parameters['param1'];
|
||||
|
||||
$this->assertArrayHasKey('dataType', $parameter);
|
||||
$this->assertEquals($parameter['dataType'], 'string');
|
||||
|
||||
$this->assertArrayHasKey('description', $parameter);
|
||||
$this->assertEquals($parameter['description'], 'Param1 description.');
|
||||
|
||||
$this->assertArrayHasKey('required', $parameter);
|
||||
$this->assertEquals($parameter['required'], true);
|
||||
|
||||
$this->assertArrayNotHasKey('default', $parameter);
|
||||
}
|
||||
|
||||
public function testGetWithRequestParamNullable(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithNullableRequestParamAction', 'test_route_22');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
|
||||
$parameters = $annotation->getParameters();
|
||||
$this->assertCount(1, $parameters);
|
||||
$this->assertArrayHasKey('param1', $parameters);
|
||||
|
||||
$parameter = $parameters['param1'];
|
||||
|
||||
$this->assertArrayHasKey('dataType', $parameter);
|
||||
$this->assertEquals($parameter['dataType'], 'string');
|
||||
|
||||
$this->assertArrayHasKey('description', $parameter);
|
||||
$this->assertEquals($parameter['description'], 'Param1 description.');
|
||||
|
||||
$this->assertArrayHasKey('required', $parameter);
|
||||
$this->assertEquals($parameter['required'], false);
|
||||
|
||||
$this->assertArrayNotHasKey('default', $parameter);
|
||||
}
|
||||
|
||||
public function testWithRequestParamArrayRequirements(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithQueryParamArrayRequirementsAction', 'test_route_29');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
$filters = $annotation->getFilters();
|
||||
|
||||
$this->assertArrayHasKey('param1', $filters);
|
||||
$this->assertArrayHasKey('requirement', $filters['param1']);
|
||||
$this->assertEquals('regexp', $filters['param1']['requirement']);
|
||||
}
|
||||
|
||||
public function testWithRequestParamPlainArrayRequirements(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithQueryParamPlainArrayRequirementsAction', 'test_route_30');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
$filters = $annotation->getFilters();
|
||||
|
||||
$this->assertArrayHasKey('param1', $filters);
|
||||
$this->assertArrayHasKey('requirement', $filters['param1']);
|
||||
$this->assertEquals('NotNull, NotBlank', $filters['param1']['requirement']);
|
||||
}
|
||||
|
||||
public function testWithRequirementParamNotSet(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
|
||||
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithRequirementParamNotSet', 'test_route_31');
|
||||
|
||||
$this->assertNotNull($annotation);
|
||||
|
||||
$filters = $annotation->getFilters();
|
||||
$this->assertCount(1, $filters);
|
||||
$this->assertArrayHasKey('param1', $filters);
|
||||
$filter = $filters['param1'];
|
||||
|
||||
$this->assertArrayNotHasKey('requirement', $filter);
|
||||
$this->assertArrayHasKey('description', $filter);
|
||||
$this->assertEquals($filter['description'], 'Param1 description.');
|
||||
}
|
||||
}
|
@ -11,12 +11,9 @@
|
||||
|
||||
namespace Nelmio\ApiDocBundle\Tests\Fixtures\Controller;
|
||||
|
||||
use FOS\RestBundle\Controller\Annotations\QueryParam;
|
||||
use FOS\RestBundle\Controller\Annotations\RequestParam;
|
||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||
use Nelmio\ApiDocBundle\Tests\Fixtures\DependencyTypePath;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class TestController
|
||||
{
|
||||
@ -128,42 +125,6 @@ class TestController
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @QueryParam(strict=true, name="page", requirements="\d+", description="Page of the overview.")
|
||||
*/
|
||||
public function zActionWithQueryParamStrictAction(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @QueryParam(name="page", requirements="\d+", default="1", description="Page of the overview.")
|
||||
*/
|
||||
public function zActionWithQueryParamAction(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @QueryParam(name="page", requirements="\d+", description="Page of the overview.")
|
||||
*/
|
||||
public function zActionWithQueryParamNoDefaultAction(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @QueryParam(name="mail", requirements=@Assert\Email, description="Email of someone.")
|
||||
*/
|
||||
public function zActionWithConstraintAsRequirements(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc(
|
||||
* description="Testing JMS",
|
||||
@ -184,24 +145,6 @@ class TestController
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @RequestParam(name="param1", requirements="string", description="Param1 description.")
|
||||
*/
|
||||
public function zActionWithRequestParamAction(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @RequestParam(name="param1", requirements="string", description="Param1 description.", nullable=true)
|
||||
*/
|
||||
public function zActionWithNullableRequestParamAction(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*/
|
||||
@ -400,31 +343,4 @@ class TestController
|
||||
public function routeWithHostAction(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @QueryParam(name="param1", requirements={"rule": "regexp", "error_message": "warning"}, description="Param1 description.")
|
||||
*/
|
||||
public function routeWithQueryParamArrayRequirementsAction(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @QueryParam(name="param1", requirements={@Assert\NotNull(), @Assert\NotBlank()}, description="Param1 description.")
|
||||
*/
|
||||
public function routeWithQueryParamPlainArrayRequirementsAction(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
*
|
||||
* @QueryParam(name="param1", description="Param1 description.")
|
||||
*/
|
||||
public function zActionWithRequirementParamNotSet(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -32,11 +32,6 @@ test_route_7:
|
||||
methods: [POST]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::anotherPostAction, _format: json }
|
||||
|
||||
test_route_8:
|
||||
path: /z-action-with-query-param
|
||||
methods: [GET]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamAction }
|
||||
|
||||
test_route_9:
|
||||
path: /jms-input-test
|
||||
methods: [POST]
|
||||
@ -47,11 +42,6 @@ test_route_10:
|
||||
methods: [GET]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::jmsReturnTestAction }
|
||||
|
||||
test_route_11:
|
||||
path: /z-action-with-request-param
|
||||
methods: [POST]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithRequestParamAction }
|
||||
|
||||
test_route_12:
|
||||
path: /secure-route
|
||||
schemes: [https]
|
||||
@ -89,16 +79,6 @@ test_route_14:
|
||||
methods: [POST]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::postTest2Action, _format: json }
|
||||
|
||||
test_route_15:
|
||||
path: /z-action-with-query-param-strict
|
||||
methods: [GET]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamStrictAction }
|
||||
|
||||
test_route_16:
|
||||
path: /z-action-with-query-param-no-default
|
||||
methods: [GET]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithQueryParamNoDefaultAction }
|
||||
|
||||
test_route_17:
|
||||
path: /z-action-with-deprecated-indicator
|
||||
methods: [GET]
|
||||
@ -136,16 +116,6 @@ test_route_exclusive:
|
||||
path: /exclusive
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::exclusiveAction }
|
||||
|
||||
test_route_21:
|
||||
path: /z-action-with-constraint-requirements
|
||||
methods: [GET]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithConstraintAsRequirementsAction }
|
||||
|
||||
test_route_22:
|
||||
path: /z-action-with-nullable-request-param
|
||||
methods: [POST]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithNullableRequestParamAction }
|
||||
|
||||
test_route_list_resource:
|
||||
path: /api/resources.{_format}
|
||||
methods: [GET]
|
||||
@ -239,21 +209,6 @@ test_route_28:
|
||||
domain: "%domain_dev%|%domain_prod%"
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithHostAction, domain: "%domain_dev%", _format: json }
|
||||
|
||||
test_route_29:
|
||||
path: /z-query-param-array-requirements
|
||||
methods: [GET]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithQueryParamArrayRequirementsAction }
|
||||
|
||||
test_route_30:
|
||||
path: /z-query-param-plain-array-requirements
|
||||
methods: [GET]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::routeWithQueryParamPlainArrayRequirementsAction }
|
||||
|
||||
test_route_31:
|
||||
path: /z-query-requirement-param-not-set
|
||||
methods: [GET]
|
||||
defaults: { _controller: Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithRequirementParamNotSet }
|
||||
|
||||
test_route_version_checking:
|
||||
path: /zz-tests-route-version.{_format}
|
||||
methods: [GET]
|
||||
|
@ -32,7 +32,7 @@ class MarkdownFormatterTest extends WebTestCase
|
||||
$expected = str_replace('DependencyType', 'dependency_type', $expected);
|
||||
}
|
||||
|
||||
$this->assertEquals($expected, $result . "\n");
|
||||
$this->assertEquals($expected, $result . "\n", 'file ' . __DIR__ . '/testFormat-result' . $suffix . '.markdown');
|
||||
}
|
||||
|
||||
public function testFormatOne(): void
|
||||
|
@ -28,7 +28,7 @@ class SimpleFormatterTest extends WebTestCase
|
||||
$suffix = class_exists('Dunglas\ApiBundle\DunglasApiBundle') ? '' : '_1';
|
||||
$expected = require __DIR__ . '/testFormat-result' . $suffix . '.php';
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($expected, $result, 'file ' . __DIR__ . '/testFormat-result' . $suffix . '.php');
|
||||
}
|
||||
|
||||
public function testFormatOne(): void
|
||||
|
@ -1816,91 +1816,6 @@ With multiple lines.',
|
||||
],
|
||||
'deprecated' => true,
|
||||
],
|
||||
12 => [
|
||||
'method' => 'POST',
|
||||
'uri' => '/z-action-with-nullable-request-param',
|
||||
'parameters' => [
|
||||
'param1' => [
|
||||
'required' => false,
|
||||
'dataType' => 'string',
|
||||
'actualType' => 'string',
|
||||
'subType' => null,
|
||||
'description' => 'Param1 description.',
|
||||
'readonly' => false,
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
],
|
||||
13 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param',
|
||||
'filters' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'description' => 'Page of the overview.',
|
||||
'default' => '1',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
],
|
||||
14 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param-no-default',
|
||||
'filters' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'description' => 'Page of the overview.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
],
|
||||
15 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param-strict',
|
||||
'requirements' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'dataType' => '',
|
||||
'description' => 'Page of the overview.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
],
|
||||
16 => [
|
||||
'method' => 'POST',
|
||||
'uri' => '/z-action-with-request-param',
|
||||
'parameters' => [
|
||||
'param1' => [
|
||||
'required' => true,
|
||||
'dataType' => 'string',
|
||||
'actualType' => 'string',
|
||||
'subType' => null,
|
||||
'description' => 'Param1 description.',
|
||||
'readonly' => false,
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
],
|
||||
17 => [
|
||||
'method' => 'ANY',
|
||||
'uri' => '/z-return-jms-and-validator-output',
|
||||
|
@ -853,64 +853,6 @@ _Route with host placeholder_
|
||||
|
||||
|
||||
|
||||
### `POST` /z-action-with-nullable-request-param ###
|
||||
|
||||
|
||||
#### Parameters ####
|
||||
|
||||
param1:
|
||||
|
||||
* type: string
|
||||
* required: false
|
||||
* description: Param1 description.
|
||||
|
||||
|
||||
### `GET` /z-action-with-query-param ###
|
||||
|
||||
|
||||
#### Filters ####
|
||||
|
||||
page:
|
||||
|
||||
* Requirement: \d+
|
||||
* Description: Page of the overview.
|
||||
* 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.
|
||||
|
||||
|
||||
### `POST` /z-action-with-request-param ###
|
||||
|
||||
|
||||
#### Parameters ####
|
||||
|
||||
param1:
|
||||
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Param1 description.
|
||||
|
||||
|
||||
### `ANY` /z-return-jms-and-validator-output ###
|
||||
|
||||
|
||||
|
@ -1967,95 +1967,6 @@ With multiple lines.',
|
||||
'deprecated' => true,
|
||||
'scope' => null,
|
||||
],
|
||||
17 => [
|
||||
'method' => 'POST',
|
||||
'uri' => '/z-action-with-nullable-request-param',
|
||||
'parameters' => [
|
||||
'param1' => [
|
||||
'required' => false,
|
||||
'dataType' => 'string',
|
||||
'actualType' => 'string',
|
||||
'subType' => null,
|
||||
'description' => 'Param1 description.',
|
||||
'readonly' => false,
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
18 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param',
|
||||
'filters' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'description' => 'Page of the overview.',
|
||||
'default' => '1',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
19 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param-no-default',
|
||||
'filters' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'description' => 'Page of the overview.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
20 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param-strict',
|
||||
'requirements' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'dataType' => '',
|
||||
'description' => 'Page of the overview.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
],
|
||||
21 => [
|
||||
'method' => 'POST',
|
||||
'uri' => '/z-action-with-request-param',
|
||||
'parameters' => [
|
||||
'param1' => [
|
||||
'required' => true,
|
||||
'dataType' => 'string',
|
||||
'actualType' => 'string',
|
||||
'subType' => null,
|
||||
'description' => 'Param1 description.',
|
||||
'readonly' => false,
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
22 => [
|
||||
'method' => 'ANY',
|
||||
'uri' => '/z-return-jms-and-validator-output',
|
||||
|
@ -710,96 +710,6 @@ _Route with host placeholder_
|
||||
|
||||
|
||||
|
||||
### `POST` /z-action-with-nullable-request-param ###
|
||||
|
||||
|
||||
#### Parameters ####
|
||||
|
||||
param1:
|
||||
|
||||
* type: string
|
||||
* required: false
|
||||
* description: Param1 description.
|
||||
|
||||
|
||||
### `GET` /z-action-with-query-param ###
|
||||
|
||||
|
||||
#### Filters ####
|
||||
|
||||
page:
|
||||
|
||||
* Requirement: \d+
|
||||
* Description: Page of the overview.
|
||||
* 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.
|
||||
|
||||
|
||||
### `POST` /z-action-with-request-param ###
|
||||
|
||||
|
||||
#### Parameters ####
|
||||
|
||||
param1:
|
||||
|
||||
* type: string
|
||||
* required: true
|
||||
* description: Param1 description.
|
||||
|
||||
|
||||
### `GET` /z-query-param-array-requirements ###
|
||||
|
||||
|
||||
#### Filters ####
|
||||
|
||||
param1:
|
||||
|
||||
* Requirement: regexp
|
||||
* Description: Param1 description.
|
||||
|
||||
|
||||
### `GET` /z-query-param-plain-array-requirements ###
|
||||
|
||||
|
||||
#### Filters ####
|
||||
|
||||
param1:
|
||||
|
||||
* Requirement: NotNull, NotBlank
|
||||
* Description: Param1 description.
|
||||
|
||||
|
||||
### `GET` /z-query-requirement-param-not-set ###
|
||||
|
||||
|
||||
#### Filters ####
|
||||
|
||||
param1:
|
||||
|
||||
* Description: Param1 description.
|
||||
|
||||
|
||||
### `ANY` /z-return-jms-and-validator-output ###
|
||||
|
||||
|
||||
|
@ -1750,143 +1750,6 @@ With multiple lines.',
|
||||
'scope' => null,
|
||||
],
|
||||
12 => [
|
||||
'method' => 'POST',
|
||||
'uri' => '/z-action-with-nullable-request-param',
|
||||
'parameters' => [
|
||||
'param1' => [
|
||||
'required' => false,
|
||||
'dataType' => 'string',
|
||||
'actualType' => 'string',
|
||||
'subType' => null,
|
||||
'description' => 'Param1 description.',
|
||||
'readonly' => false,
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
13 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param',
|
||||
'filters' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'description' => 'Page of the overview.',
|
||||
'default' => '1',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
14 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param-no-default',
|
||||
'filters' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'description' => 'Page of the overview.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
15 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-action-with-query-param-strict',
|
||||
'requirements' => [
|
||||
'page' => [
|
||||
'requirement' => '\\d+',
|
||||
'dataType' => '',
|
||||
'description' => 'Page of the overview.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
16 => [
|
||||
'method' => 'POST',
|
||||
'uri' => '/z-action-with-request-param',
|
||||
'parameters' => [
|
||||
'param1' => [
|
||||
'required' => true,
|
||||
'dataType' => 'string',
|
||||
'actualType' => 'string',
|
||||
'subType' => null,
|
||||
'description' => 'Param1 description.',
|
||||
'readonly' => false,
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
17 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-query-param-array-requirements',
|
||||
'filters' => [
|
||||
'param1' => [
|
||||
'requirement' => 'regexp',
|
||||
'description' => 'Param1 description.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
18 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-query-param-plain-array-requirements',
|
||||
'filters' => [
|
||||
'param1' => [
|
||||
'requirement' => 'NotNull, NotBlank',
|
||||
'description' => 'Param1 description.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
19 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/z-query-requirement-param-not-set',
|
||||
'filters' => [
|
||||
'param1' => [
|
||||
'description' => 'Param1 description.',
|
||||
],
|
||||
],
|
||||
'https' => false,
|
||||
'authentication' => false,
|
||||
'authenticationRoles' => [
|
||||
],
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
20 => [
|
||||
'method' => 'ANY',
|
||||
'uri' => '/z-return-jms-and-validator-output',
|
||||
'response' => [
|
||||
@ -2006,7 +1869,7 @@ With multiple lines.',
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
21 => [
|
||||
13 => [
|
||||
'method' => 'ANY',
|
||||
'uri' => '/z-return-selected-parsers-input',
|
||||
'parameters' => [
|
||||
@ -2054,7 +1917,7 @@ With multiple lines.',
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
22 => [
|
||||
14 => [
|
||||
'method' => 'ANY',
|
||||
'uri' => '/z-return-selected-parsers-output',
|
||||
'response' => [
|
||||
@ -2174,7 +2037,7 @@ With multiple lines.',
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
23 => [
|
||||
15 => [
|
||||
'method' => 'POST',
|
||||
'uri' => '/zcached',
|
||||
'https' => false,
|
||||
@ -2184,7 +2047,7 @@ With multiple lines.',
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
24 => [
|
||||
16 => [
|
||||
'method' => 'POST',
|
||||
'uri' => '/zsecured',
|
||||
'https' => false,
|
||||
@ -2194,7 +2057,7 @@ With multiple lines.',
|
||||
'deprecated' => false,
|
||||
'scope' => null,
|
||||
],
|
||||
25 => [
|
||||
17 => [
|
||||
'method' => 'GET',
|
||||
'uri' => '/zz-tests-route-version.{_format}',
|
||||
'requirements' => [
|
||||
|
@ -13,9 +13,5 @@ if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$load
|
||||
'php composer.phar install' . PHP_EOL);
|
||||
}
|
||||
|
||||
if (class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
|
||||
Doctrine\Common\Annotations\AnnotationRegistry::registerLoader([$loader, 'loadClass']);
|
||||
}
|
||||
|
||||
// force loading the ApiDoc annotation since the composer target-dir autoloader does not run through $loader::loadClass
|
||||
class_exists('Nelmio\ApiDocBundle\Annotation\ApiDoc');
|
||||
|
@ -25,7 +25,6 @@
|
||||
"require-dev": {
|
||||
"doctrine/annotations": "^1.0",
|
||||
"friendsofphp/php-cs-fixer": "^3",
|
||||
"friendsofsymfony/rest-bundle": "^3.7",
|
||||
"jms/serializer": "^3.15",
|
||||
"jms/serializer-bundle": "^4.1|^5.4",
|
||||
"phpunit/phpunit": "~9.5",
|
||||
@ -45,7 +44,6 @@
|
||||
"suggest": {
|
||||
"symfony/form": "For using form definitions as input.",
|
||||
"symfony/validator": "For making use of validator information in the doc.",
|
||||
"friendsofsymfony/rest-bundle": "For making use of REST information in the doc.",
|
||||
"jms/serializer": "For making use of serializer information in the doc."
|
||||
},
|
||||
"autoload": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user