在POST请求的卷曲中应用不需要的编码的招摇过市ui
我正在swagger中使用OpenAPI3.0.2,如果我想用以下内容记录我的发帖电话:在POST请求的卷曲中应用不需要的编码的招摇过市ui,post,encoding,django-rest-framework,swagger,openapi,Post,Encoding,Django Rest Framework,Swagger,Openapi,我正在swagger中使用OpenAPI3.0.2,如果我想用以下内容记录我的发帖电话: paths: /<myPath> post: tags: - <myTag> summary: <mySummary> description: <myDescription> operationId: <myID> requestBody:
paths:
/<myPath>
post:
tags:
- <myTag>
summary: <mySummary>
description: <myDescription>
operationId: <myID>
requestBody:
description: <myDescription>
content:
application/x-www-form-urlencoded:
schema:
oneOf:
- $ref: '#/components/schemas/<schema1>'
- $ref: '#/components/schemas/<schema2>'
但是如果没有成功您也可以发布定义吗?您使用的是什么版本的Swagger UI?(打开浏览器开发工具,切换到控制台选项卡并评估
版本
)。我已将架构添加到我的帖子中。我大摇大摆地跑-editor@3.6.36在本地(从github)我发现,只有在模式中使用oneOf:
atribute时,问题才会出现。删除这些或用anyOf
重新指定它们可以解决问题。这似乎是一个bug?在“试用”期间,您为“请求正文”输入了哪些数据?
components:
schemas:
<schema1>:
type: object
properties:
example1:
type: array
items:
type: string
pageSize:
type: integer
format: int64
page:
type: integer
format: int64
<schema2>:
type: object
properties:
example2:
type: array
items:
type: string
pageSize:
type: integer
format: int64
page:
type: integer
format: int64
curl -X POST "http://localhost:8000/<myPath>" -H "accept: */*" -H "Content-Type: application/x-www-form-urlencoded" -d "0=%7B&1=e&2=x&3=a&4=m&5=p&6=l&7=e&8=1&9=%3A&10=%5B&11=t&12=e&13=s&14=t&15=%5D&16=%7D"
<QueryDict: {'0': ['{'], '1': ['e'], '2': ['x'], '3': ['a'], '4': ['m'], '5': ['p'], '6': ['l'], '7': ['e'], '8': ['1'], '9': ['}']}>
encoding:
payload:
contentType: application/json