我正在使用L5 Swagger
从DarkOnLine
来生成使用OpenApi原理图的Swagger文档。
要使用模式,我可以
@OA\Property(property="certification", type="array", @OA\Items(ref="#/components/schemas/Certification"))
字符串
它工作得很好,
"certification": [
{
"certification_id": 0,
"name": "string"
}
],
型
。但它会建立一个内含多个对象的数组区块,并在其中加上方括号。
我怎么用同样的工作却失去了阵列。比如说
@OA\Property(property="certification", type="object", @OA\Items(ref="#/components/schemas/Certification")),
型
以便去掉方括号并只显示类似对象。
"certification": {
"certification_id": 0,
"name": "string"
}
型
2条答案
按热度按时间1qczuiv01#
您可以:
字符串
@OA\Items
注解仅在要指定数组中的属性时使用(请参见数据类型:数组)。在本例中,您只想描述一个对象,因此只需在属性中引用该对象的模式并删除
@OA\Items
。8nuwlpux2#
您可以像这样定义子属性:
字符串
或通过使用
型