首页 > 解决方案 > NelmioApiDocBundle 不起作用“规范中没有定义操作!” Symfony 3.4

问题描述

我想为我的 symfony 3 项目配置 nelmio。我安装了捆绑包,但最后我收到一条未定义操作的消息!!!!怎么了?有任何想法吗?

/**
     * List the rewards of the specified user.
     *
     * This call takes into account all confirmed awards, but not pending or refused awards.
     *
     * @Route("/product", name="product", methods={"GET"})
     * @SWG\Response(
     *     response=200,
     *     description="Returns the rewards of an user",
     *     @SWG\Schema(
     *         type="array",
     *         @SWG\Items(ref=@Model(type=Reward::class, groups={"full"}))
     *     )
     * )
     * @SWG\Parameter(
     *     name="order",
     *     in="query",
     *     type="string",
     *     description="The field used to order rewards"
     * )
     * @SWG\Tag(name="rewards")
     * @Security(name="Bearer")
     *
     */
    public function getProducts()
    {
        $product = $this->entityManager->getRepository(Product::class)->getProducts();
        $productSerializer = $this->serializer->serialize($product, 'json');
        return new JsonResponse($productSerializer);
    }

标签: symfony-3.4nelmioapidocbundle

解决方案


推荐阅读