I've nested objects :
class Review{
#[Groups(['read'])]
public int id;
#[Groups(['read'])]
public string author;
/**
* @var Comment[] comments
*/
public array comments;
}
class Comment{
public string lang;
public string comment;
}
I use this Review object as response for an api route.
I have a normalizer that replace comments from Review by a comment string (the comment in desire language) so the response of my route is an JSON object like :
{
id:3,
author:'Philip',
comment:'Good comment'
}
I use attributs to describe the route's return :
#[OA\Response(
response: 200,
description: 'Return a review',
content: new OA\JsonContent(ref: new Model(type: Review::class,groups: ['read']))
)]
The comment property is missing in the description of the response, is there a way to add it ?