mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-03 08:09:25 +03:00
ab005c4129
* implement alternative naming system via configuration * use strict comparison * test di configs * rever * test naming aliases are applied * set "default" as default area * test names are passed to generators * cs formatting * added extra check for built-int types * cs * added documentation about alternative names * allow to create the same alias in two different areas * document and test better aliasing strategy * specify that the last matching rule is used * Make last matching rule wins * Fix documentation
29 lines
1.0 KiB
ReStructuredText
29 lines
1.0 KiB
ReStructuredText
Alternative Names
|
|
=================
|
|
|
|
NelmioApiDoc generates automatically the model names but the ``nelmio_api_doc.models.names`` option allows to
|
|
customize the names for some models.
|
|
|
|
Configuration
|
|
-------------
|
|
|
|
You can define alternative names for each group and area combination, the last matching rule is used:
|
|
|
|
.. code-block:: yaml
|
|
|
|
nelmio_api_doc:
|
|
models:
|
|
names:
|
|
- { alias: MainUser, type: App\Entity\User}
|
|
- { alias: MainUser_light, type: App\Entity\User, groups: [light] }
|
|
- { alias: MainUser_secret, type: App\Entity\User, areas: [private] }
|
|
- { alias: MainUser, type: App\Entity\User, groups: [standard], areas: [private] }
|
|
|
|
|
|
In this case the class ``App\Entity\User`` will be aliased into:
|
|
|
|
- ``MainUser`` when no more detailed rules are specified
|
|
- ``MainUser_light`` when the group is equal to ``light``
|
|
- ``MainUser_secret`` for the ``private`` area
|
|
- ``MainUser`` for the ``private`` area when the group is equal to ``standard``
|