It is a new implementation based on
go-openapi
。
install: go get -u github.com/the-pawn-2017/r5t
CAREFULLY USE IT IN YOUR PROJECT, BECAUSE IT IN DEVELOPING
I am currently testing with my own projects to refine R5T, expecting it to stabilize by the end of August. At that point, I will mark R5T as ready for official use, making it convenient for everyone.
v0.3
example/echo
Reqjson
,ResJson
,ResString
.go /test/spec_test
view some example
type Test struct {
A string
B string `validate:"required"`
}
s := spec.NewSpec()
s.Security(
security.WithOAuth2Code("ziteal", "http://10.45.8.189:8080/oauth/v2/authorize", "http://10.45.8.189:8080/oauth/v2/token",
security.AddScope("openid", "OPENID IS USING FOR ID")),
)
// than, you can use OAuth2 code mode now
s.Post("/gkd").NeedSecurify("ziteal", []string{"openid"}).
ReqJSON(model.ModelOf[Test](), req.WithExample(Test{A: "A", B: "B"})).
ResJSON(http.StatusOK, model.ModelOf[Test](), res.WithExample(Test{A: "A", B: "B"}))
inspired by a-h/rest