Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Sep 15, 2023
1 parent 7d2078d commit 26921c2
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 92 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (

require (
github.com/huandu/go-clone v1.6.0 // indirect
github.com/stretchr/testify v1.8.3 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/ysmood/gop v0.1.0 // indirect
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
Expand All @@ -28,5 +29,5 @@ github.com/ysmood/got v0.35.1/go.mod h1:R7naGpP/qR1i9b5xOCkQnfuEAUPq0TROuTffdxbJ
github.com/ysmood/vary v0.3.2 h1:oxUmATxrs4BPTHo1b3zNgyzTGZr/6s7zvdM9F9+M4kw=
github.com/ysmood/vary v0.3.2/go.mod h1:X9WYOJwS8Hyeh7Qs08haaeelNru/UIOPUggUnRwxHmM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
1 change: 0 additions & 1 deletion go.work
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ use (
./lib/bench
./lib/examples/as-echo-middleware
./lib/examples/as-gin-middleware
./lib/examples/validator
)
3 changes: 1 addition & 2 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
github.com/NaturalSelectionLabs/goapi v0.3.2/go.mod h1:jAWqk2/n5dWMcvJZsdIjPDrll33Cnxxqv4j2f3Im13Y=
github.com/NaturalSelectionLabs/jschema v0.7.9 h1:Tyq5k6WCp+n0ZNp5rh4zga1VA0N7BwQZ2t4g+56VOQE=
github.com/NaturalSelectionLabs/jschema v0.7.9/go.mod h1:7l4ZhkX89M9ma6/ATvSsDRcj9DiVNEy6nbW4qwIfVPY=
github.com/NaturalSelectionLabs/jschema v0.7.11 h1:fpNDxMm0wtHQx/bTbIkmrK3jEblYrQmFX6HCZoitC+8=
github.com/NaturalSelectionLabs/jschema v0.7.11/go.mod h1:7l4ZhkX89M9ma6/ATvSsDRcj9DiVNEy6nbW4qwIfVPY=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/validator/v10 v10.15.3/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
Expand Down
17 changes: 0 additions & 17 deletions lib/examples/validator/go.mod

This file was deleted.

31 changes: 0 additions & 31 deletions lib/examples/validator/go.sum

This file was deleted.

33 changes: 0 additions & 33 deletions lib/examples/validator/main.go

This file was deleted.

4 changes: 2 additions & 2 deletions operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ func (op *Operation) handle(w http.ResponseWriter, r *http.Request, qs url.Value
resType = res.Type()

if _, ok := interfaces[vary.ID(setType)]; !ok {
panic(fmt.Sprintf("response of %s should goapi.Interface(new(%s))", op.path.path, setType.String()))
panic(fmt.Sprintf("handler response of path `%s` must goapi.Interface(new(%s))", op.path.path, setType.String()))
}

if _, ok := interfaces[vary.ID(setType)].Implementations[vary.ID(resType)]; !ok {
panic(fmt.Sprintf("response of %s should goapi.Interface(new(%s), %s{})",
panic(fmt.Sprintf("handler response of path `%s` must goapi.Interface(new(%s), %s{})",
op.path.path, setType.String(), resType.String()))
}
}
Expand Down
10 changes: 6 additions & 4 deletions operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,17 @@ func TestOperation(t *testing.T) {

g.Eq(g.Req("", tr.URL("/res-missed-type")).JSON(), map[string]interface{}{
"error": map[string]interface{} /* len=2 */ {
"code": "internal_error",
"message": `response of /res-missed-type should goapi.Interface(new(goapi_test.res), goapi_test.resEmpty{})`,
"code": "internal_error",
"message": "handler response of path `/res-missed-type` must " +
"goapi.Interface(new(goapi_test.res), goapi_test.resEmpty{})",
},
})

g.Eq(g.Req("", tr.URL("/forget-create-interface")).JSON(), map[string]interface{}{
"error": map[string]interface{} /* len=2 */ {
"code": "internal_error",
"message": `response of /forget-create-interface should goapi.Interface(new(goapi_test.resForgetCreateInterface))`,
"code": "internal_error",
"message": "handler response of path `/forget-create-interface` " +
"must goapi.Interface(new(goapi_test.resForgetCreateInterface))",
},
})

Expand Down

0 comments on commit 26921c2

Please sign in to comment.