-
-
Notifications
You must be signed in to change notification settings - Fork 895
Open
Labels
Description
Version
5.9.2
Description
If a controller has a DTO return type, it is ignored. Neither native return type nor php-doc @return type are added to the schema.
#[Route('/api/test', name: 'api_test', methods: [ 'GET' ])]
public function index(): NameDto
{
return new NameDto();
}class NameDto
{
public string $first = "John";
public string $last = "Doe";
}JSON OpenApi
JSON OpenApi
{
"openapi": "3.0.0",
"info": {
"title": "My App",
"description": "This is an awesome app!",
"version": "1.0.0"
},
"paths": {
"/api/test": {
"get": {
"operationId": "get_api_test",
"responses": {
"default": {
"description": ""
}
}
}
}
}
}Additional context
This is not a question of adding OA\Response attribute. While this is always an option, a leaner approach should be to get the responses described automatically, same as QueryParameters and RequestPayloads controller arguments.
Reactions are currently unavailable