获取以下 openapi 规范文件并将其粘贴到 editor.swagger.io 或通过 openapi-generator 以您选择的语言运行它:
openapi: 3.0.0
info:
version: whatever
title: whatever
paths:
/something:
post:
responses:
200:
description: Successful operation
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
stringpart:
type: string
format: uuid
binarypart:
type: string
format: binary
encoding:
binarypart:
headers:
X-Custom-Header:
description: This is a custom header
schema:
type: string
为什么在任何地方都没有提到
X-Custom-Header
?没有地方可以在 UI 渲染中设置它,也没有在任何生成的代码中引用它。据我所知,根据我在这里找到的示例,这是有效的 openapi3 模式:https://swagger.io/docs/specification/describing-request-body/multipart-requests/