具有复杂内容和多个附件的电子邮件



我需要一个电子邮件的一些复杂的内容(json格式)和多个数组附件的例子。附件应该可以是任何格式。到目前为止,我已经到处找遍了,我开始觉得这可能是不可能的。我想要的是如下所示:

/somepath:
put:
summary: sends an email
description: Send an email
operationId: send-mail
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/data.SomeData'
type: object
properties:
format: binary
attachment:
content: 
multipart/form-data:
schema:
properties:
my-attachment:
type: array
items:
type: string
format: binary 

这是我在swagger 2.0中尝试做的,它看起来更现实,而swagger 2.0不接受:

/somePath:
put:
consumes:
- multipart/form-data
description: Send an email
operationId: send-mail
parameters:
- description: The Data model
in: body
name: someData
required: true
schema:
$ref: '#/definitions/data.someData'
type: object
- description: Base 64 upload attachment
in: formData
name: file
type: array
items:
type: string
format: binary

找到Openapi 3.0的答案:

multipart/form-data:
schema:
type: object
properties:
body:
$ref: '#/components/schemas/data.SomeData'
file:
type: array
description: Base 64 upload attachment
items:
type: string
format: binary
required:
- body

相关内容

  • 没有找到相关文章

最新更新