Vis*_*lPi 3 multipart swagger openapi
我有一个创建包含以下内容的多部分文件的服务:
是否有可能使用YAML在提供的OpenAPI(扬鞭)定义这个自定义响应模型,?
可以使用OpenAPI 3.0而不是OpenAPI 2.0(fka Swagger 2.0)描述多部分响应。
openapi: 3.0.0
...
paths:
/something:
get:
responses:
'200':
description: OK
content:
multipart/mixed: # <-- Content-Type of the response
schema:
type: object
properties:
# Part 1 - application/octet-stream
file: # <-- part name
type: string
format: binary
# Part 2 - application/json
metadata: # <-- part name
type: object
properties:
foo:
type: string
example: bar
required:
- foo
# Optional, see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#encoding-object
encoding:
file:
...
metadata:
...
Run Code Online (Sandbox Code Playgroud)
可选encoding键可用于覆盖Content-Typefor子部件或添加子部件的标题(例如Content-Disposition)。
| 归档时间: |
|
| 查看次数: |
1882 次 |
| 最近记录: |