/**
* @return OpenApiResponse[]
*/
private function createDefaultResponses(): array
{ return [ Response::HTTP_NOT_FOUND =>
$this->
createErrorResponse(Response::HTTP_NOT_FOUND, 'Not Found', 'Resource with given parameter was not found.'
),
Response::HTTP_FORBIDDEN =>
$this->
createErrorResponse(Response::HTTP_FORBIDDEN, 'Forbidden', 'This operation is restricted to logged in users.'
),
Response::HTTP_UNAUTHORIZED =>
$this->
createErrorResponse(Response::HTTP_UNAUTHORIZED, 'Unauthorized', 'Authorization information is missing or invalid.'
),
Response::HTTP_BAD_REQUEST =>
$this->
createErrorResponse(Response::HTTP_BAD_REQUEST, 'Bad Request', 'Bad parameters for this endpoint. See documentation for the correct ones.'
),
Response::HTTP_NO_CONTENT =>
new OpenApiResponse(['description' => 'No Content', 'response' => Response::HTTP_NO_CONTENT
]),
];
} private function createErrorResponse(int
$statusCode, string
$title, string
$description): OpenApiResponse
{ $schema =
new Schema([ 'ref' => '#/components/schemas/failure',
]);
$example =
[ 'errors' =>
[ [