我正在使用此程序包https://github.com/zircote/swagger-php来编译摇摇欲坠的注释,并且很难创建可恢复的参数列表。我可以重复使用单个参数,如下所示:
/** * @OA\Get( * path="/api/v2/seasons/{season_id}", * description="Show season(s).", * summary="List season(s) from comma separated id list", * tags={"seasons"}, * security = { { "basicAuth": {} } }, * @OA\Parameter( * name="id", in="path",required=true, @OA\Schema(type="integer") * ), * @OA\Parameter(ref="#/components/parameters/max-child-depth"), * @OA\Parameter(ref="#/components/parameters/sort-by"), * @OA\Parameter(ref="#/components/parameters/sort-order"), * @OA\Parameter(ref="#/components/parameters/page"), * @OA\Parameter(ref="#/components/parameters/page-size"), * @OA\Parameter(ref="#/components/parameters/CatalogHeader"), * @OA\Parameter(ref="#/components/parameters/SiteHeader"), * @OA\Parameter(ref="#/components/parameters/AcceptLangHeader"), * @OA\Parameter(ref="#/components/parameters/DebugHeader"), * @OA\Response(response=200, ref="#/components/responses/200", * @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/SeasonResponse")) * ), * @OA\Response(response=404, ref="#/components/responses/404"), * * ) */
但是id真正想要的是类似于以下内容,因为我可以在每个路由注释定义中重用标题和全局查询字符串参数的列表。
/** * @OA\Get( * path="/api/v2/seasons/{season_id}", * description="Show season(s).", * summary="List season(s) from comma separated id list", * tags={"seasons"}, * security = { { "basicAuth": {} } }, * @OA\Parameter( * name="id", in="path",required=true, @OA\Schema(type="integer") * ), * parameters={ref="#/components/<IDK EXACTLY WHAT SECTION>/<but this would be a reusable param list>"}, * @OA\Response(response=200, ref="#/components/responses/200", * @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/SeasonResponse")) * ), * @OA\Response(response=404, ref="#/components/responses/404"), * * ) */
我试图在我的全局组件定义文件中创建@Link批注,但是当我使用它时不起作用。似乎不是该注释的正确用法。同样对于此GET路由,uri有一个参数,因此id仍需要能够指定该路由特定的参数,而且还要附加全局参数列表。
我正在使用此程序包https://github.com/zircote/swagger-php来编译swagger注释,并且很难创建可恢复的参数列表。我可以重复使用以下各个参数...
要引用参数,您必须使用parameter