带有复杂内容和多个附件OpenAPI 3.0的电子邮件

发布于 2025-02-13 00:48:29 字数 1254 浏览 0 评论 0原文

我需要一个带有一些complext内容(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

I need an example for an email with some complext content(json format) and multiple array attachment. The attachments should be able to be of any format. so far I have searched everywhere and I am starting to think it may not be possible. what I would like is something like below:

/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 

This is what I have tried to do in swagger 2.0, which looks more realistic and swagger 2.0 does not accept:

 /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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蒲公英的约定 2025-02-20 00:48:29

找到了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

Found the Answer for 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文