我有一个在 python flask 中实现的OpenAPI3 POST方法,其方法如下:
/DoSomething:
post:
operationId: postDoSomething
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/MyBody'
required: true
components:
schemas:
MyBody:
type: object
properties:
Images:
type: array
items:
$ref: '#/components/schemas/Image'
Ids:
type: array
items:
$ref: '#/components/schemas/Ids'
Date:
type: string
format: date-time
我需要将属性(图片,ID,日期)作为可选参数。
例如,当我从Images数组为null的C#应用程序中发布此消息时,在服务器上出现以下错误。
validation error: None is not of type 'array'
如何使参数可选?