I'd like to outline a multipart form request body, with some fields which are required, and other fields which are optional. Generally, in OAS Schema Objects, all properties not explicitly marked with required: true
are defaulted to optional. However, when outlining a requestBody
with multipart/form-data
content, this seems to go by the wayside, and all fields are required.
I have tried multiple ways of designating the fields required vs optional. I receive compilation errors when trying to explicitly designate a field as optional with required: false
.
OAS3 spec:
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required:
- foo
properties:
foo:
type: string
format: binary
bar:
type: string
format: binary
Expected: Detail a multipart/form-data
requestBody
with some fields required and some optional.
In the code example above, foo
should be a required file, while bar
should be an optional file.