我开始了一个新的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
时,它工作正常:
但是招摇之一:/api/swagger
(应该根据:This doc工作)对我的路线来说是空的:
命令app / console api:swagger:dump
工作正常:
我错过了什么吗?