0

我有一个 Swagger YAML 函数,例如:

/acitem/image:         
    x-swagger-router-controller: image_send
    get:
      description: Returns 'image' to the caller
      operationId: imageSend
      parameters:
        - name: name
          in: query
          description: The image to be sent
          required: false
          type: string      
      responses:
        "200":
          description: Success
          schema:            
            # $ref: "#/definitions/ImageResponse"
            type: string
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"

我的内容类型生成为:

produces:
  - application/json    
  - text/plain
  - text/html
  - image/png

但即使在那之后我也有大摇大摆的验证错误 在此处输入图像描述

我的问题是 - 是否有一种优化的方法来编写图像响应,或者有没有办法排除我的图像响应验证???

提前致谢。

4

1 回答 1

0

你在这里有一个错误:

      responses:
    "200":
      description: Success
      schema:            
        # $ref: "#/definitions/ImageResponse"
        type: string

您已经使用 $ref 定义了模式响应结构,您不需要 'type: string'

此外,该错误可能与 ImageResponse 的定义有关

于 2015-07-28T19:44:56.330 回答