首页 > 解决方案 > Api 平台 - 从 swagger 中删除自动代码响应描述

问题描述

我在带有自定义控制器的 POST 方法中有一个端点,我只在我的YAML文件中描述了200 个代码响应。但是当我查看我的招摇文档时,我可以显示 201、400 和 422 代码响应。我怎样才能删除它们?

标签: symfonyapi-platform.com

解决方案


我迟到了,但这对我有用:https ://api-platform.com/docs/core/operations/#configuring-operations

在 config/api_platform/resources.yaml 中,我添加了:

App\Entity\CriteriaDeleteChatRooms:
collectionOperations:
  post:
    status: 200

完成此操作后,状态码已从 201 更新为 200。


推荐阅读