为什么NelmioApiDocBundle会生成Nelmio doc,但是无法生成Swagger json?

时间:2017-10-24 16:29:39

标签: symfony swagger nelmioapidocbundle

我开始了一个新的Symfony 2.8项目,我想用swagger来记录。 我安装了NelmioApiDocBundle,它运行正常。这是我唯一的路线:

/**
 *
 * @ApiDoc(
 *     section="Notification",
 *      resource=true,
 *   description="This method receive a notification and send it to the people concerned",
 *   parameters={
 *      {"name"="message", "dataType"="string", "required"=true, "description"="The message to be send"}
 *  })
 *
 * @Route("/notify")
 * @Method("POST")
 * @param Request $request
 *
 * @return JsonResponse
 */
public function postNotifyAction(Request $request)
{ ...

我的routing.yml:

notification:
    resource: "@NotificationBundle/Controller/"
    type:     annotation
    prefix:   /
NelmioApiDocBundle:
    resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
    prefix:   /api/doc
nelmio_api_swagger:
    resource: "@NelmioApiDocBundle/Resources/config/swagger_routing.yml"
    prefix: /api/swagger

当我访问路线/api/doc时,它工作正常:

Nelmio doc

但是招摇之一:/api/swagger(应该根据:This doc工作)对我的路线来说是空的:

enter image description here

命令app / console api:swagger:dump工作正常: enter image description here

我错过了什么吗?

0 个答案:

没有答案