英文:
golang: swagger REST api documents generator
问题
我在互联网上搜索了一下,但没有找到一个好的解决方案。我正在寻找一个非常具体的东西 - 一个Go语言版本的aiohttp_swagger
。
aiohttp_swagger
是一个Python包,可以做一些神奇的事情。在端点处理方法中,你可以编写一些注释代码,它会自动解析并生成Swagger文档。当服务器启动并运行时,会在服务器中插入一个特殊的URL /api/doc
,用户可以在该URL上实时查看文档。
我知道这与aiohttp
框架的实现有关,而Go语言的使用方式可能不太流行(我自己也没有使用过),但我仍然非常喜欢这个解决方案,并希望在Go语言领域找到类似的东西。
所以我的问题可能有点开放性:在Go语言中是否有与aiohttp_swagger
包等效(或类似)的解决方案?
英文:
I've searched internet but couldn't find a good solution. I'm looking for something that pretty specific - a golang copy of aiohttp_swagger
.
That is a Python package which does magical things. In the endpoint handler method, one write some comment code and it'll be automatically parsed and generates swagger documentation. When the server is up and running, a special URL /api/doc
handler will be inserted into the server where people can see it live.
I understand it's tied into the implementation of aiohttp
framework and the way Go is used, web framework is not as popular (not using one myself), but I still like that solution very much and would like to find something in the Go land.
So my question is a bit open I guess: is there an equivalent (or rough) of aiohttp_swagger
package in Go?
答案1
得分: 1
go-swagger是基于文档注释来实现的:https://goswagger.io/generate/spec.html
go-restful有一个用于创建Swagger 2.0文档的构建器:https://github.com/emicklei/go-restful-openapi
英文:
go-swagger does it based on doc comments: https://goswagger.io/generate/spec.html
go-restful has a builder for creating swagger 2.0 documents: https://github.com/emicklei/go-restful-openapi
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论