小编Fáb*_*chi的帖子

部署包含“文件”类型参数的端点时出错

我正在尝试部署一个包含类型参数的file简单端点。

我将gcloud service-management deploy命令与以下符合 openapi 的 yaml 一起使用:

swagger: "2.0"

info:
  description: "Image API"
  title: "Image API"
  version: "v1"

host: "image-api.endpoints.myproject.cloud.goog"
basePath: "/v1"

schemes:
- "https"

paths:
  "/images":
    post:
      description: "Adds an image"
      operationId: "add"
      consumes:
      - "multipart/form-data"      
      produces:
      - "application/json"
      responses:
        201:
          description: "An image create response"
          schema:
            $ref: "#/definitions/ImageResponse"
      parameters:
      - name: filepath
        in: formData
        required: true
        type: string
      - name: image
        in: formData
        required: false
        type: file

definitions:
  ImageResponse:
    type: object
    properties: …
Run Code Online (Sandbox Code Playgroud)

google-cloud-endpoints gcloud openapi google-cloud-endpoints-v2

1
推荐指数
1
解决办法
1184
查看次数