微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 openapi_context (Swagger) - api-platform 中用自定义参数替换“id”参数

如何解决在 openapi_context (Swagger) - api-platform 中用自定义参数替换“id”参数

我有一个实体的自定义操作,它使用 PUT 方法,我想在我的 swagger (OpenApi) 文档中记录参数。

这是定义

/*
 * itemOperations={
 *                  "get",*                  "patch",*                  "put",*                  "delete",*                  "activate"={
 *                      "method"="PUT",*                      "path"="/user/{token}/activate",*                      "requirements"={"token"="^\w{32}$"},*                      "controller"=ActivateUser::class,*                      "normalization_context"={"groups"={"user:read"}},*                      "denormalization_context"={"groups"={"user:activation"}},*                      "read"=false,*                      "validation_groups"={"Activate"},*                      "openapi_context"={
 *                          "summary"="Attiva un utente tramite token dopo la registrazione.",*                          "description"="Cambia lo stato dell'utente in 'attivo' permettendo così il login.",*                          "parameters"={
 *                              {
 *                                "in"="path",*                                "name"="token",*                                "required"=true,*                                "type"="string",*                                "description"="Il token generato al momento della registrazione."
 *                              }
 *                          }
 *                      }
 *                  },*              },*/

感兴趣的部分是 "openapi_context" 键,然后是 "parameters"。 此描述不会更改有关参数定义的任何内容,ID 要求仍然存在并且没有令牌描述(我阅读了文档 here for path parameters in open api context

my actual result

我错在哪里?有办法吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。