I would like to reuse a common response structure, normally it looks like this:
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(
* @OA\Property(property="status", type="string", example="OK"),
* @OA\Property(property="code", type="number", example="20000"),
* @OA\Property(
* property="data",
* ref=@Model(type=OutputDto::class)
* )
* )
* )
Which produces the following view
As a solution to my problem I added a common schema:
SuccessResponse:
description: OK
properties:
status: { type: string, example: OK }
code: { type: integer, example: 20000 }
data: { type: array }
and changes the response to
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(
* allOf={
* @OA\Schema(ref="#/components/schemas/SuccessResponse"),
* @OA\Schema(type="object",
* @OA\Property(
* property="data",
* ref=@Model(type=OutputDto::class)
* )
* )
* }
* )
* )
which produces an ugly, nearly unreadable output:
Is there a solution to this?
P.S. NelmioApiDocBundle v4.9.0

