如何以 http://localhost:3000/resources/api/?key=aslkdajd1323121lklakskdl
的形式传递基本 url Swagger 的用户界面?
我能够访问 http://localhost:3000/resources/api
但是当我添加身份验证过滤器并传递 key 时,它说,Unauthorized
.
使用 swagger 1.X
在 index.html 中通过 apiKeyauthorization 预填充参数没有帮助,但是当我在 UI 中键入 key 时,它起作用了。无法理解其中的原因。希望有人能帮助我理解它。
最佳答案
试试这个 swagger 2.0 文件(使用 http://studio.restlet.com 降级到 1.2 版):
{
"swagger": "2.0",
"info": {
"version": "0.0.1",
"title": "Todo App"
},
"host": "localhost:3000",
"schemes": [
"http"
],
"paths": {
"/resources/api": {
"post": {
"parameters": [
{
"name": "key",
"in": "query",
"description": "key",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Successful response"
}
}
}
}
}
}
关于html - 带有参数的Swagger ui url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31056771/