【发布时间】:2018-07-14 09:30:18
【问题描述】:
我正在使用带有 OpenAPI 3.0 的 Swagger 编辑器。我需要记录一条包含上传图片的路线。尝试“试用”时,我没有让文件浏览器在请求正文中选择要上传的图像,我得到的只是一个带有参数名称和类型的 JSON 字符串。
这是路由的 YAML 描述:
openapi: 3.0.0
...
paths:
/media/upload/thumbnail:
post:
tags:
- media
- publications
security:
- bearerAuth: []
summary: upload a kid's publication
operationId: uploadPublication
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
upload:
type: string
format: binary
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: ObjectId of the uploaded file in db (original size)
example: 5a6048b3fad06019afe44f24
filename:
type: string
example: myPainting.png
thumbnail:
type: string
description: ObjectId of the uploaded file in db (thumbnai size)
example: 5a6048b3fad06019afe44f26
'400':
description: Authentication failed
我在这里缺少什么?
【问题讨论】:
标签: swagger swagger-ui swagger-editor openapi