gotomicro / eapi Goto Github PK
View Code? Open in Web Editor NEW一个通过分析 AST 生成 Swagger 文档的工具
License: MIT License
一个通过分析 AST 生成 Swagger 文档的工具
License: MIT License
type Foo struct {
ID uint `json:"id" binding:"required"`
}
支持直接解析这个 tag,就不需要再写 @require
注释了
因为写在handler一个文件会写多次重复
以下是demo
// @tags User
{
app.GET("/ping", test.Ping)
app.GET("/message", test.Message)
}
或者这种
// @tags User
func registerRoutes() {
g.GET("/v1/resources", handler.ResourceList)
g.POST("/v1/resources", handler.ResourceCreate)
g.GET("/v1/pods", handler.PodList)
}
这两个函数没有生成参数,请问是这样写吗?
配置:
request:
- type: '*gin/core.Context'
method: 'DefaultQuery' # gin提供的函数
return:
data:
type: 'args[0]'
- type: '*gin/core.Context'
method: 'MyQuery' # 自定义函数
return:
data:
type: 'args[0]'
go代码:
current := c.Query("current")
pageSize := c.Query("pageSize")
fmt.Println("xxx", current, pageSize)
test := c.MyQuery("test")
fmt.Println("test", test)
test2 := c.DefaultQuery("test22", "222")
fmt.Println("test", test2)
我们api目录下放的都是controller相关代码,用gin框架解析参数之类的,执行的命令
egogen --output docs2 --plugin gin --dir api
docs2目录中生成的swagger.json内容:
{
"swagger": "2.0",
"info": {},
"paths": {}
}
没有日志输出,请问该如何排查呢?感谢
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.