Geo*_*ler 3 api rest dropwizard swagger swagger-ui
我对 drop Wizard (dropwizard.io) 还很陌生,刚刚完成了他们的教程。我想将 Swagger (swagger.io) 集成到这个示例应用程序中。我发现:
生成的 JSON 似乎非常相似,但是我无法扩展 REST 资源以查看它们各自的操作。我注意到的唯一区别是 swagger 集成的示例代码使用了 SERVER 而官方放置向导示例使用的是 APPLICATION
这是一个图像(i.stack.imgur.com/QzhPa.png)
请你告诉我我的方法有什么问题。非常感谢。这是我的方法的代码:https : //github.com/geoHeil/dropwizardSwaggerIntegrationNotWorking
编辑:
for api - docs {
"apiVersion": "0.0",
"swaggerVersion": "1.2",
"apis": [{
"path": "/sample"
}, {
"path": "/hello-world",
"description": "Operations about greetings"
}]
}
for sample {
"apiVersion": "0.0",
"swaggerVersion": "1.2",
"basePath": "http://geoHeil.local:8080",
"resourcePath": "/sample",
"apis": [{
"path": "/sample",
"operations": [{
"method": "GET",
"summary": "Sample endpoint",
"notes": "",
"type": "void",
"nickname": "get",
"authorizations": {},
"parameters": []
}]
}, {
"path": "/sample/hello-with-path-param/{name}",
"operations": [{
"method": "GET",
"summary": "Sample endpoint with path param",
"notes": "",
"type": "void",
"nickname": "getWithPathParam",
"authorizations": {},
"parameters": [{
"name": "name",
"required": true,
"type": "string",
"paramType": "path"
}]
}]
}, {
"path": "/sample/hello-with-query-param",
"operations": [{
"method": "GET",
"summary": "Sample endpoint with query param",
"notes": "",
"type": "void",
"nickname": "getWithQueryParam",
"authorizations": {},
"parameters": [{
"name": "name",
"required": false,
"type": "string",
"paramType": "query"
}]
}]
}]
}
for hello - world {
"apiVersion": "0.0",
"swaggerVersion": "1.2",
"basePath": "http://geoHeil.local:8080",
"resourcePath": "/hello-world",
"apis": [{
"path": "/hello-world",
"operations": [{
"method": "GET",
"summary": "Greetings endpoint",
"notes": "",
"type": "void",
"nickname": "sayHello",
"authorizations": {},
"parameters": [{
"name": "name",
"required": false,
"items": {
"type": "string"
},
"paramType": "query"
}]
}]
}]
}Run Code Online (Sandbox Code Playgroud)
现在有一个 Swagger 规范 2.0 示例可用:
https://github.com/swagger-api/swagger-samples/tree/master/java/java-dropwizard
这使用最新的 swagger 核心库,具有最少的依赖性。请注意,Jackson 的版本需要从 dropwizard 的 2.3.2 更新到 swagger 的 2.4.2。
| 归档时间: |
|
| 查看次数: |
13753 次 |
| 最近记录: |