NelmioApiDocBundle
NelmioApiDocBundle copied to clipboard
[Bug]: Lost data format in schema for array of objects
Version
4.25.2
Description
Lost data format in schema for array of objects.
Old schema:
"contestants": {
"title": "List of contestants",
"type": "array",
"items": {
"$ref": "#/components/schemas/StatContestant2"
}
...
"StatContestant2": {
"required": [
"members",
"name",
"type",
"side"
],
"properties": {
"members": {
"title": "Teams",
"type": "array",
"items": {
"$ref": "#/components/schemas/StatMember2"
}
},
"name": {
"title": "Name",
"type": "string"
},
"type": {
"title": "Type of contestant",
"type": "string",
"enum": [
"player",
"team",
"pair"
]
},
"side": {
"title": "Side of contestant",
"type": "string",
"enum": [
"home",
"away"
]
},
"outcome": {
"title": "Outcome result for contestant in game",
"type": "string",
"enum": [
"lose",
"win",
"tie"
],
"nullable": true
},
"country": {
"title": "Country",
"nullable": true,
"oneOf": [
{
"$ref": "#/components/schemas/Country2"
}
]
}
},
"type": "object"
},
New schema:
"contestants": {
"$ref": "#/components/schemas/StatContestant[]2"
},
...
"StatContestant[]2": {
"type": "object"
},
Documents are:
/**
* List of contestants
*
* @var Collection<array-key, StatContestant>
*/
#[Groups(['game:list'])]
#[Assert\NotBlank]
#[ODM\EmbedMany(targetDocument: StatContestant::class)]
private Collection $contestants;
...
/**
* Teams
*
* @var Collection<array-key, StatMember>
*/
#[Groups(['game:list'])]
#[Assert\NotNull]
#[ODM\EmbedMany(targetDocument: StatMember::class)]
private Collection $members;
Additional context
No response
Looks like a bug introduced with the implementation of PHPStan https://github.com/nelmio/NelmioApiDocBundle/pull/2249