【发布时间】:2020-12-19 14:59:15
【问题描述】:
在我的 Spring Boot 应用程序中,我的端点由 SpringBoot 应用程序中的 header 参数验证。 当前的招摇 json 看起来像这样:
// part of current swagger.json
...
"paths": {
"/path1/{param1}": {
"get": {
"parameters": [
{
"name": "param1",
"in": "path",
"type": "string",
"required": true
}
]
}
}
}
...
我想使用springdoc-openapi-ui 配置添加缺少的参数,所以它看起来像这样:
// I want to achieve swagger.json which contains additional parameter
...
"paths": {
"/path1/{param1}": {
"get": {
"parameters": [
{
"name": "param1",
"in": "path",
"type": "string",
"required": true
},
{
"name": "missingParam",
"in": "header",
"type": "string",
"required": true
}
]
}
}
}
...
我尝试通过从Common Parameters for Various Paths 添加到我的appplication.yml 解决方案来实现这一目标
#application.yml
...
components:
parameters:
hiddenParam:
in: header
name: missingParam
required: true
schema:
type: string
paths:
/path1:
get:
parameters:
- $ref: '#/components/parameters/hiddenParam'
但它不起作用。
我的问题:
- 有没有办法使用应用程序配置修改我的招摇结果?
- 我想定义参数模板并将其添加到所有端点,我该如何实现?
【问题讨论】:
标签: spring-boot swagger springdoc-openapi-ui