在Openapi中使用枚举作为参数,将引号添加到参数
我正在使用枚举作为API中的参数。但这导致参数被引号包围。
在下面的图像中,它显示了%22
围绕参数摘要 - %22summary%22
时,我从下拉列表中选择它。
如何避免在参数中添加报价?
/v1/metrics/{profile}:
parameters:
- $ref: "#/components/parameters/profile"
get:
summary: Get list of field or summary profile metrics
description: Retrieves list of metrics for field or summary profile
tags:
- profile-metrics
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ProfileMetrics"
'400':
$ref: "#/components/responses/BadRequest"
'404':
$ref: "#/components/responses/NotFound"
default:
$ref: "#/components/responses/UnexpectedError"
配置文件参数架构
profile:
name: profile
description: profile type either field or summary
schema:
type: string
enum: [ field, summary ]
in: path
required: true
任何帮助都将受到赞赏
I am using Enums as parameter in api. But it results in the parameters being surrounded by quotes.
In the image below it shows how %22
surrounds the parameter summary - %22summary%22
as I select it from drop down.
How can I avoid adding quotes to the parameter ?
/v1/metrics/{profile}:
parameters:
- $ref: "#/components/parameters/profile"
get:
summary: Get list of field or summary profile metrics
description: Retrieves list of metrics for field or summary profile
tags:
- profile-metrics
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ProfileMetrics"
'400':
$ref: "#/components/responses/BadRequest"
'404':
$ref: "#/components/responses/NotFound"
default:
$ref: "#/components/responses/UnexpectedError"
profile parameter schema
profile:
name: profile
description: profile type either field or summary
schema:
type: string
enum: [ field, summary ]
in: path
required: true
Any help is appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论