nelmio api doc bundle 不呈现输入类型 [英] nelmio api doc bundle not render input type
问题描述
我使用 Nelmio API Doc Bundle 来公开我的 api 文档.我将它与基本配置一起使用.也使用 Symfony 3.1.但是在控制器上,即使我在 ApiDoc 注释中定义了输入参数,文档也不会显示输入.
Im using Nelmio API Doc Bundle to expose my api documentation. I use it with base configuration. Also using Symfony 3.1. But on controller even when i define the input parameter inside ApiDoc annotation the documentation does not show the input.
* @ApiDoc(
* section="Customer",
* description="Request reset password",
* input="AppBundle\Form\ResendConfirmationEmailType",
* statusCodes={
* 200="Returned when successful",
* 500="Returned on not found Customer"
* },
* tags={
* "beta" = "#4A7023",
* "v2" = "#ff0000"
* }
* )
我缺少任何配置吗?或任何已知的错误?
There is any configuration im missing? or any known bug?
谢谢
推荐答案
这是一个已知错误.https://github.com/nelmio/NelmioApiDocBundle/issues/208而且这并不是一个真正的错误,而是一种过时的方法,我相信在 Symfony 中使用到 2.6.
It's a known bug. https://github.com/nelmio/NelmioApiDocBundle/issues/208 And it's not really a bug, rather it's outdated approach, used in Symfony up to 2.6, I believe.
解决方案很简单 - 将您的 FormType 声明为服务,使用并为其实现 getName
,然后在输入中使用别名.
The solution is simple - declare you FormType as a service, use, implement a getName
for it, and then use an alias in input.
* input="resend_confirmation_type",
这篇关于nelmio api doc bundle 不呈现输入类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!