Swagger ui url带参数

Jac*_*aro 5 html swagger swagger-ui

如何在表单中传递基本网址http://localhost:3000/resources/api/?key=aslkdajd1323121lklakskdl来招摇ui?

我能够访问http://localhost:3000/resources/api但是当我添加auth过滤器并传递密钥时,它说,Unauthorized.

使用swagger 1.X

通过index.html中的apiKeyauthorization预先填充参数没有帮助,但是当我在UI中键入键时,它起作用了.无法理解其原因.希望有人可以帮助我理解它.

Nel*_* G. 2

尝试这个 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"
                    }
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)