Php 如何从@SWG\Response中使用的模型中排除某些(嵌套)属性

Php 如何从@SWG\Response中使用的模型中排除某些(嵌套)属性,php,annotations,swagger-2.0,swagger-php,Php,Annotations,Swagger 2.0,Swagger Php,我用PHPLaravel编写API,并使用swagger(2.0)注释(lib:use)生成swagger.json。我大摇大摆地说: @SWG\Definition( definition="Space", @SWG\Property( property="id", type="integer", example=33), @SWG\Property( property="name", type="string" ), @SWG\Property( proper

我用PHPLaravel编写API,并使用swagger(2.0)注释(lib:use)生成swagger.json。我大摇大摆地说:

@SWG\Definition(
    definition="Space",
    @SWG\Property( property="id", type="integer", example=33),
    @SWG\Property( property="name", type="string" ),
    @SWG\Property( property="dataA", type="string", example="very long data string" ),
    @SWG\Property( property="dataB", type="string", example="very long data string" ),
),

@SWG\Get(
    path="/api/v1/client/space/list",
    @SWG\Response( response=200, description="OK", 
        @SWG\Schema(
               type="array", 
               @SWG\Items(ref="#/definitions/Space"), 
        )
    )
)
上面的api应该返回空格列表(在表中显示),但我只需要获取id名称——然而空格也有非常重的字段dataAdataB——这在表中是不需要的。有没有一种方法可以排除这些字段,而无需为响应创建单独的空间定义(以避免违反“不要重复自己”的规则)?有没有这样的机制:

@SWG\Items(ref="#/definitions/Space", exclude={"dataA","dataB"}),  
和/或排除更多嵌套字段,如

exclude={"dataA.securityField","dataA.someList[].heavyField"}
?


PS:我也将此报告为问题/问题。

目前没有排除(look)等功能的实现。但是,您可以尝试以下部分可接受的方法(您创建了新定义,但此定义重用了空间的部分定义):

@SWG\Get
中更改
@SWG\Items(ref=“#/definitions/Space”),

@SWG\Items(ref="#/definitions/SpaceListEntry"),
此解决方案部分令人满意,但优于空间定义的完整副本

@SWG\Items(ref="#/definitions/SpaceListEntry"),