我正在尝试将 swagger 与播放框架一起使用。
我在代码中添加了 API 注释,我可以通过
本地主机:9000/api-docs
{
apiVersion: "beta",
swaggerVersion: "1.2",
basePath: "http://localhost",
resourcePath: "/metrics",
produces: [
"application/json"
],
apis: [
{
path: "/metrics",
operations: [
{
method: "POST",
summary: "Save metrics",
...
authorizations: { },
parameters: [ ],
responseMessages: [
{
code: 400,
message: "Expecting Json data"
},
]
}
]
}
]
}
但是当我尝试使用 swagger ui 探索它时,我无法扩展或列出操作。
在 swagger ui index.html 中,我进行了以下更改。
$(function () {
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = url[1];
} else {
url = "http://localhost:9000/api-docs";
}
...
window.authorizations.add("Accept", new ApiKeyAuthorization("Accept", "application/json", "header"));
我是否缺少任何配置。请提供建议或指点。