protected function RestGenerator::getErrorResponses in OpenAPI 8
Get the error responses.
Return value
array Keys are http codes. Values responses.
See also
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md...
1 call to RestGenerator::getErrorResponses()
- RestGenerator::getPaths in src/
Plugin/ openapi/ OpenApiGenerator/ RestGenerator.php - Returns the paths information.
File
- src/
Plugin/ openapi/ OpenApiGenerator/ RestGenerator.php, line 262
Class
- RestGenerator
- Defines an OpenApi Schema Generator for the Rest module.
Namespace
Drupal\openapi\Plugin\openapi\OpenApiGeneratorCode
protected function getErrorResponses() {
$responses['400'] = [
'description' => 'Bad request',
'schema' => [
'type' => 'object',
'properties' => [
'error' => [
'type' => 'string',
'example' => 'Bad data',
],
],
],
];
$responses['500'] = [
'description' => 'Internal server error.',
'schema' => [
'type' => 'object',
'properties' => [
'message' => [
'type' => 'string',
'example' => 'Internal server error.',
],
],
],
];
return $responses;
}