Я использую базовую конфигурацию API пакета nelmio:
Код: Выделить всё
nelmio_api_doc:
documentation:
info:
title: 'API Documentation'
description: ''
version: '1.0.0'
areas:
path_patterns:
- '^/(?!doc|\_error|\_profiler|)'
Код: Выделить всё
/**
* @OA\Schema(
* schema="User",
* type="object",
* description=""
* )
* User
*
* @ORM\Table(name="user")
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
*/
class User
{
/**
* @var int
*
* @OA\Property(
* type="integer",
* example="6083"
* )
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
}
Код: Выделить всё
/**
* @Rest\View(serializerGroups={"test"})
* @Rest\Get("/listusers")
*
* @OA\Response(
* ref="success",
* response=200,
* description="OK",
* @OA\JsonContent(ref="#/components/schemas/User")
* )
*
*/
public function listUsersAction(Request $request)
{
....
}
Я пробовал очистить кеш, php bin/console nelmio:apidoc:generate (также генерирует ту же ошибку).
Подробнее здесь: https://stackoverflow.com/questions/793 ... -as-schema
Мобильная версия