【发布时间】:2017-04-29 11:02:00
【问题描述】:
我尝试为我的一个 API 定义自定义路由名称,从那时起,API Doc 显示该路由两次。任何想法为什么?
这是我的 API 的定义:
/**
* @ApiDoc(
* description = "Sends the support email to the HelpDesk address",
* statusCodes = {
* 204 = "Returned when successful",
* 400 = "Returned when the parameters are incorrect",
* 401 = "Returned when the token is invalid",
* 500 = "Returned when there's an internal server error"
* },
* input="AppBundle\Form\Type\SupportEmailType"
* )
* @Post("/support-requests")
* @Rest\View ()
*/
public function postSupportAction(Request $request)
这是我的routing.yml 文件:
# app/config/routing.yml
app:
resource: "@AppBundle/Controller/"
type: annotation
NelmioApiDocBundle:
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
prefix: /api/doc
user:
type: rest
resource: AppBundle\Controller\UserController
【问题讨论】:
-
你能把 routing.yml 的设置也贴出来吗?
-
@AlexandruCosoi 我已经用我的 routing.yml 文件的内容更新了问题
-
我不记得我上次使用 FOSRestBundle 是什么时候了,但我要废话一句,根据这个问题,你在某处定义了两次路由:github.com/FriendsOfSymfony/FOSRestBundle/issues/813
-
@Sebastian @Post("/support-requests") 的命名空间是什么?
-
@AlexandruCosoi 这是 Symfony 网站上提到的那个:symfony.com/doc/current/bundles/FOSRestBundle/…,看起来像这样
use FOS\RestBundle\Controller\Annotations\Post;
标签: symfony fosrestbundle nelmioapidocbundle