gpt4 book ai didi

具有相同代码的多个响应的 PHP swagger 注释

转载 作者:行者123 更新时间:2023-12-04 13:38:53 25 4
gpt4 key购买 nike

在我的 Controller 方法之一中,我尝试放置这样的注释:

 *     @OA\Response(
* response="404",
* description="Invalid field"
* ),
* @OA\Response(
* response="404",
* description="Entity not found"
* )

但是现在当我尝试构建文档时,我从 openapi 收到一条错误消息:
Warning: Multiple @OA\Response() with the same response="400":

我知道现在有一个 oneOf Swagger ,这似乎正是我的目的。但是,我不知道如何使用它。

最佳答案

     *@OA\Response(
* response=200,
* description="Successful operation",
* @OA\JsonContent(
* oneOf={
* @OA\Schema(ref="#/components/responses/schema1"),
* @OA\Schema(ref="#/components/responses/schema2"),
* }
* ),
*),

关于具有相同代码的多个响应的 PHP swagger 注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60100157/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com