我正在使用 swagger 3.0,我需要帮助使用表单数据,就像在 swagger UI 中使用它一样。 我需要使用它的方式是这样的。请我需要它作为使用 swagger 编辑器版本 3.0.1 添加文件的后路由
我尝试了不同的方法,但出现错误: 路径上的结构错误 路径名只能以
/
开头
跳转到第22行
paths./v1/especialidades.post 处的结构错误
不应该有额外的属性
附加属性:消耗、生产
跳转到第24行
解析器错误
映射条目的缩进错误
跳转到第27行
paths./v1/especialidades.post.parameters.0 处的结构错误
不应该有额外的属性
附加属性:类型
跳转到第34行
paths./v1/especialidades.post.parameters.0 处的结构错误
应该具有 schema
或 content
属性
跳转到第34行
paths./v1/especialidades.post.parameters.0.in 处的结构错误
应等于允许值之一
allowedValues:路径、查询、标头、cookie
跳转到第 35 行
这是基本的
multipart/form-data
OpenAPI 描述
openapi: 3.0.3
info:
title: test
version: "1.0.0"
description: a description of an api with a "multipart/form-data" request
servers:
- url: 'https://api.host.com/v1'
name: the host server
paths:
"/image":
post:
description: a description of the api
requestBody:
description: a description of the requestBody
required: true
content:
"multipart/form-data":
schema:
type: object
properties:
name:
type: string
file:
type: string
format: binary
encoding:
name:
headers:
content-disposition:
$ref: "#/components/headers/content-disposition"
contentType: "application/json"
file:
headers:
content-disposition:
$ref: "#/components/headers/content-disposition"
contentType: 'image/png, image/jpeg'
responses:
"200":
description: OK
content:
"application/json":
schema:
type: object
properties: {}
components:
headers:
content-disposition:
description: a description of this header
required: true
schema:
type: string
这适用于 app.swaggerhub.com https://app.swaggerhub.com/apis/jeremyfiel/test/1.0.0#/default/post_image
或在新编辑器上