我开始了一个新的 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)
{ ...
我的路由.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/consoleapi:swagger:dump
工作正常:
我错过了什么吗?