【问题标题】:Unable to merge Swagger FOSRestBundle无法合并 Swagger FOSRestBundle
【发布时间】:2019-06-05 08:59:19
【问题描述】:

起初,Google 只向我显示了 2 个网站的搜索结果。我在 Symfony 4 中有项目,我使用 FOSRestBundle 和自动配置路由。我也使用 NelmioApiDoc。使用 POST 方法一切都很好,但是当我需要对特定路由使用 GET 时,我猜 Nelmio 会尝试将 GET 方法与 FOSRestBundle 合并,但我不在 NELMIO 中使用 GET。

/api/doc 向我展示: 用户注意:无法合并@SWG\Get()

我不知道如何解决这个问题。

这是我在 Controller 中的注解。

 * @SWG\Tag(name="User")
 * @Security("is_granted('read', user)", message="Access denied.")
 * @Rest\Get("/api/users")

【问题讨论】:

    标签: api annotations swagger symfony4


    【解决方案1】:

    答案很简单。我需要在 SWG 中添加这条路线的一般定义。在我看来,swg 应该显示类似:“SWG\Get missing declaration”,但计算机也会出错。 :)

    @SWG\Get( path="/api/path", summary="Confirm")
    

    【讨论】:

      猜你喜欢
      • 2012-05-21
      • 2020-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-21
      • 2016-09-15
      • 2015-05-30
      • 1970-01-01
      相关资源
      最近更新 更多