是否可以将数组属性中定义的架构与其他属性结合起来?

时间:2021-02-26 14:09:18

标签: swagger swagger-2.0 swagger-php

我定义了我的模型架构,我想在数组属性中引用其中一个,并带有其他属性。如果我没有额外的属性,我当然可以这样做:

     *     @OA\Response(
     *        response=200,
     *        description="",
     *        @OA\JsonContent(
     *           @OA\Property(property="data", type="object", allOf={
     *               @OA\Schema(ref="#/components/schemas/Site"),
     *               @OA\Schema(
     *                   @OA\Property(property="groups", type="array", @OA\Items(ref="#/components/schemas/Group")
     *               )
     *           })
     *        )
     *     ),

但是我想要做的是这样的:

     *     @OA\Response(
     *        response=200,
     *        description="",
     *        @OA\JsonContent(
     *           @OA\Property(property="data", type="object", allOf={
     *               @OA\Schema(ref="#/components/schemas/Site"),
     *               @OA\Schema(
     *                   @OA\Property(property="groups", type="array", @OA\Items(
     *                       @OA\Schema(ref="#/components/schemas/Group"),
     *                       @OA\Property(property="additional_property", type="string")
     *                   )
     *               )
     *           })
     *        )
     *     ),

这可能吗?

0 个答案:

没有答案