Merge branch '3.x'

This commit is contained in:
Guilhem Niot 2021-04-23 15:18:59 +02:00
commit a7573897fb
2 changed files with 17 additions and 16 deletions

View File

@ -27,6 +27,7 @@ use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
@ -129,7 +130,7 @@ final class NelmioApiDocExtension extends Extension implements PrependExtensionI
} }
} }
$container->register('nelmio_api_doc.generator_locator') $container->register('nelmio_api_doc.generator_locator', ServiceLocator::class)
->setPublic(false) ->setPublic(false)
->addTag('container.service_locator') ->addTag('container.service_locator')
->addArgument(array_combine( ->addArgument(array_combine(

View File

@ -72,7 +72,7 @@ Open a command console, enter your project directory and execute the following c
defaults: { _controller: nelmio_api_doc.controller.swagger } defaults: { _controller: nelmio_api_doc.controller.swagger }
As you just installed the bundle, you'll likely see routes you don't want in As you just installed the bundle, you'll likely see routes you don't want in
your documentation such as `/_profiler/`. To fix this, you can filter the your documentation such as ``/_profiler/``. To fix this, you can filter the
routes that are documented by configuring the bundle: routes that are documented by configuring the bundle:
.. code-block:: yaml .. code-block:: yaml
@ -143,8 +143,8 @@ To document your routes, you can use the SwaggerPHP annotations and the
class UserController class UserController
{ {
      /** /**
        * List the rewards of the specified user. * List the rewards of the specified user.
* *
* This call takes into account all confirmed awards, but not pending or refused awards. * This call takes into account all confirmed awards, but not pending or refused awards.
* *
@ -182,27 +182,27 @@ Use it instead of a definition reference and the bundle will deduce your model p
.. note:: .. note::
   A model can be a Symfony form type, a Doctrine ORM entity or a general PHP object. A model can be a Symfony form type, a Doctrine ORM entity or a general PHP object.
This annotation has two options: This annotation has two options:
* ``type`` to specify your model's type:: * ``type`` to specify your model's type::
/** /**
    * @OA\Response( * @OA\Response(
    * response=200, * response=200,
    *     @Model(type=User::class) *     @Model(type=User::class)
    * ) * )
    */ */
* ``groups`` to specify the serialization groups used to (de)serialize your model:: * ``groups`` to specify the serialization groups used to (de)serialize your model::
  /** /**
    * @OA\Response( * @OA\Response(
    * response=200, * response=200,
    *     @Model(type=User::class, groups={"non_sensitive_data"}) *     @Model(type=User::class, groups={"non_sensitive_data"})
    * ) * )
    */ */
.. tip:: .. tip::