0

首先对我糟糕的英语感到抱歉。

我想为我的 api 使用 NelmioApiDoc,安装和配置我没有问题,我的路线返回这个结果: nemlio return

当我尝试向控制器插入注释时,没有任何变化,页面没有变化。我的控制器:

<?php

namespace App\Controller;

use App\Entity\Product;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Serializer\Exception\NotEncodableValueException;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Annotations as OA;
/**
 * Class ApiProductController
 *
 */
class ProductController extends AbstractController
{

    /**
     * @Route("/api/products/showAll", name="productsShow")
     * @Method({"GET"})
     * @OA\Response(
     *     response=200,
     *     description="Returns the products of an user",
     *     @OA\JsonContent(
     *        type="array",
     *        @OA\Items(ref=@Model(type=Product::class))
     *     )
     * )
     * @OA\Parameter(
     *     name="order",
     *     in="query",
     *     description="The field used to order products",
     *     @OA\Schema(type="string")
     * )
     * @OA\Tag(name="product")
     * @Security(name="Bearer")
     */
    public function showAll()
    { ... }

如果你对我有回应,我接受!谢谢大家

4

0 回答 0