mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
[Doc] Some minor fixes in index.rst
This commit is contained in:
parent
5e6140cd65
commit
051fca9070
@ -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
|
||||||
@ -140,8 +140,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.
|
||||||
*
|
*
|
||||||
@ -179,48 +179,49 @@ 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::
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @SWG\Response(
|
* @SWG\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::
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @SWG\Response(
|
* @SWG\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* @Model(type=User::class, groups={"non_sensitive_data"})
|
* @Model(type=User::class, groups={"non_sensitive_data"})
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
When used at the root of ``@SWG\Response`` and ``@SWG\Parameter``, ``@Model`` is automatically nested
|
When used at the root of ``@SWG\Response`` and ``@SWG\Parameter``, ``@Model``
|
||||||
in a ``@SWG\Schema``.
|
is automatically nested in a ``@SWG\Schema``.
|
||||||
|
|
||||||
To use ``@Model`` directly within a ``@SWG\Schema``, ``@SWG\Items`` or ``@SWG\Property``, you have to use the ``$ref`` field::
|
To use ``@Model`` directly within a ``@SWG\Schema``, ``@SWG\Items`` or
|
||||||
|
``@SWG\Property``, you have to use the ``$ref`` field::
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @SWG\Response(
|
* @SWG\Response(
|
||||||
* @SWG\Schema(ref=@Model(type=User::class))
|
* @SWG\Schema(ref=@Model(type=User::class))
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* or
|
* or
|
||||||
*
|
*
|
||||||
* @SWG\Response(
|
* @SWG\Response(
|
||||||
* @SWG\Schema(type="object",
|
* @SWG\Schema(type="object",
|
||||||
* @SWG\Property(property="foo", ref=@Model(type=FooClass::class))
|
* @SWG\Property(property="foo", ref=@Model(type=FooClass::class))
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Symfony Form types
|
Symfony Form types
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
Loading…
x
Reference in New Issue
Block a user