mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Merge pull request #1820 from vpassapera/patch-1
Updates documentation to show a side effect of design decision regarding context groups with JMS serializer
This commit is contained in:
commit
5808651c19
@ -257,6 +257,28 @@ General PHP objects
|
||||
models. Additional information is extracted from the PHP doc block comment,
|
||||
but the property types must be specified in the JMS annotations.
|
||||
|
||||
NOTE: If you are using serialization contexts (e.g. Groups) each permutation will be treated as a separate Path. For example if you have the following two variations defined in different places in your code:
|
||||
|
||||
.. code-block:: php
|
||||
/**
|
||||
* A nested serializer property with no context group
|
||||
*
|
||||
* @JMS\VirtualProperty
|
||||
* @JMS\Type("ArrayCollection<App\Response\ItemResponse>")
|
||||
* @JMS\Since("1.0")
|
||||
*
|
||||
* @return Collection|ItemResponse[]
|
||||
*/
|
||||
public function getItems(): Collection|array
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
.. code-block
|
||||
@OA\Schema(ref=@Model(type="App\Response\ItemResponse", groups=["Default"])),
|
||||
|
||||
It will generate two different component schemas (ItemResponse, ItemResponse2), even though Default and blank are the same. This is by design.
|
||||
|
||||
In case you prefer using the `Symfony PropertyInfo component`_ (you
|
||||
won't be able to use JMS serialization groups), you can disable JMS serializer
|
||||
support in your config:
|
||||
|
Loading…
x
Reference in New Issue
Block a user