gogf / swagger Goto Github PK
View Code? Open in Web Editor NEWSwagger wrapper for GoFrame project.
Home Page: https://goframe.org
Swagger wrapper for GoFrame project.
Home Page: https://goframe.org
// @summary 用户注册接口
func (a *userApi) SignUp(r *ghttp.Request) {
// Some codes
}
$ go mod tidy
module thash
go 1.15
require (
github.com/gogf/gf v1.15.3
github.com/gogf/swagger v1.2.0
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d // indirect
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 // indirect
golang.org/x/text v0.3.5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
)
GoFrame CLI Tool v1.15.0, https://goframe.org
Install Path: C:\Windows\gf.exe
Build Detail:
Go Version: go1.15.5
GF Version: v1.15.1
Git Commit: 3b3701b7e8aa5fcc9f12ffc0f567ffce62d6308d
Build Time: 2021-01-19 15:21:28
swagger.json
generated2021-02-20 19:11:12.916 producing swagger files...
go: found github.com/swaggo/swag/cmd/swag in github.com/swaggo/swag v1.7.0
go: golang.org/x/text upgrade => v0.3.5
go: golang.org/x/tools upgrade => v0.1.0
go: golang.org/x/net upgrade => v0.0.0-20210220033124-5f55cee0dc0d
go: github.com/russross/blackfriday/v2 upgrade => v2.1.0
go: github.com/go-openapi/spec upgrade => v0.20.3
go: gopkg.in/yaml.v2 upgrade => v2.4.0
go: golang.org/x/sys upgrade => v0.0.0-20210220050731-9a76102bfb43
go: github.com/go-openapi/jsonpointer upgrade => v0.19.5
go: github.com/mailru/easyjson upgrade => v0.7.7
go: github.com/cpuguy83/go-md2man/v2 upgrade => v2.0.0
go: github.com/go-openapi/swag upgrade => v0.19.14
go: github.com/go-openapi/jsonreference upgrade => v0.19.5
2021-02-20 19:11:15.094 'swag' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
exit status 1
$ swag init
2021/02/21 18:21:13 Generate swagger docs....
2021/02/21 18:21:13 Generate general API Info, search dir:./
2021/02/21 18:21:21 ParseComment error in file app\api\user.go :cannot find type definition: model.UserApiSignUpReq
D:\project\gf-cli>go get -u github.com/gogf/swagger
# github.com/gogf/gf/net/ghttp/internal/client
D:\soft\Go\path\pkg\mod\github.com\gogf\[email protected]\net\ghttp\internal\client\client_tracing.go:73:3: undefined: attribute.Any
D:\soft\Go\path\pkg\mod\github.com\gogf\[email protected]\net\ghttp\internal\client\client_tracing_tracer.go:150:3: undefined: attribute.Any
D:\soft\Go\path\pkg\mod\github.com\gogf\[email protected]\net\ghttp\internal\client\client_tracing_tracer.go:151:3: undefined: attribute.Any
go version go1.17.2 windows/amd64
gf-demos 项目运行时,路径多了swagger目录,css资源404
vendor\github.com\gogf\gf-swagger\swagger\swagger.go:76:5: s.Logger undefined (type *ghttp.Server has no field or method Logger)
本地测试localhost 可以,用容器部署到服务器上后指定了host为服务器IP 仍然无法访问swagger.json
在正式环境中, 还是需要隐藏或者关闭的
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.