如何使用node.js在openapi3的yaml文件中实现multipart / form-data?

时间:2019-06-20 09:07:53

标签: node.js openapi

我正在设置一个新服务器,我的目标是在OpenApi3.0的yaml文件中实现multipart / form-data。我在Node.js中遇到“不应具有其他属性(消耗)”错误,并且想知道如何解决此错误或如何在OpenApi3.0的yaml文件中实现multipart / form-data?

这是我实现这个目标的OpenApi3.0的yaml文件,它将报告我上面提到的错误。

openapi: 3.0.1
info:
  title: myapp
  description: My cool app
  version: 1.0.0
servers:
- url: /api/v1/user
tags:
- name: User
  description: User Operations
paths:
  /onboarding/signature:
    post:
      tags:
      - User
      description: Onboarding Upload Signature API - with parameters user's email and image file
      requestBody:
        description: Request Body {email, image}
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/onboardingSignature'
        required: true
      responses:
        200:
          description: OK 
        201:
          description: Created
        400: 
          description: Bad Request
        500:
          description: Internal Server Error
components:
  schemas:
    onboardingSignature:
      description: Onboarding Signature File
      type: object
      properties:
        email: 
          type: string
        image:
          format: binary

我希望以Swagger上传文件的实现使用multipart / form-data格式。

0 个答案:

没有答案