Swaggerui 3不尊重'爆炸:false`为openapi 3 spec中的查询数组参数
我在OpenAPI 3规格中定义了一个查询参数,如下所示:
parameters:
- in: query
name: categories
schema:
type: array
items:
type: string
enum:
- category1
- category2
style: form
explode: false
期望是,如果我使用“尝试!”功能并选择类别1和类别2,形成的URL应包含: ?类别= category1,category2
,而是swaggerui形式的URL的一部分如下: ?类别= category1& categories = category2
因此,Swaggerui似乎正在将参数对待,好像爆炸
设置为true
。
如何让Swaggerui使用逗号分隔的配方,因为这就是服务器所期望的?
I have a query parameter defined in the OpenAPI 3 spec as follows:
parameters:
- in: query
name: categories
schema:
type: array
items:
type: string
enum:
- category1
- category2
style: form
explode: false
The expectation is that if I use the "Try it out!" feature and select both category1 and category2, the URL formed should contain:?categories=category1,category2
However, instead SwaggerUI forms that part of the URL as follows:?categories=category1&categories=category2
Thus, it seems that SwaggerUI is treating the parameter as though explode
is set to true
.
How can I get SwaggerUI to go with the comma-separated formulation as that's what the server is expecting?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题在于
爆炸
和样式
属性应该放置在与>架构
的相同级别上,而不是嵌套在其中。The issue was that the
explode
andstyle
properties should have been placed at the same level asschema
, not nested inside of it.