好吧,我对anyOf在OpenAPiI V3文档平台中引用的用法有点迷茫。
现在,根据api平台文档,我们可以传递openapi上下文如下
* @ApiProperty(
* attributes={
* "openapi_context"={
* "type"="string",
* "enum"={"one", "two"},
* "example"="one"
* }
* }
* )不幸的是,我找不到关于如何使用anyOf的文档(或示例)。现在,按照前辈的例子,我希望这是一个类似于
* @ApiProperty(
* attributes={
* "openapi_context"={
* "anyOf"={
* "type"="string",
* "type"="url",
* "type"="base64"
* },
* "example"="one"
* }
* }
* )不幸的是,这是行不通的。
此外,还不清楚如何在每个anyOf中给出一个示例、描述等。
发布于 2022-06-28 09:56:16
如果它对来这里的人有任何用处,下面的PHP 8属性可以工作:
#[ApiProperty(openapiContext: [
'anyOf' => [
['type' => 'string'],
['type' => 'url'],
['type' => 'base64'],
]
])]https://stackoverflow.com/questions/54944592
复制相似问题