Skip to content

Commit

Permalink
fix matches
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Jul 31, 2024
1 parent b0daec9 commit 3e4d95e
Show file tree
Hide file tree
Showing 31 changed files with 279 additions and 248 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.22-alpine3.20 as protoc-builder

ENV PROTOC_VERSION=27.2
ENV PROTOC_VERSION=27.3
ARG TARGETARCH

#hadolint ignore=DL3018
Expand Down
10 changes: 10 additions & 0 deletions example/simple/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,14 @@ func main() {
log.Fatalf("error from grpc: %v", err)
}
log.Printf("Greeting: %s (return code %d)", r.GetMessage(), r.GetReturnCode())

r, err = c.SayHello(context.Background(), &pb.Request{Vint64: 10012}, grpc.UseCompressor(gzip.Name))
if err != nil {
log.Fatalf("error from grpc: %v", err)
}
if r.GetMessage() != "Regexp matched" {
log.Fatalf("failed to get valid message: %v", r.GetMessage())
}

log.Printf("Greeting (gzip): %s (return code %d)", r.GetMessage(), r.GetReturnCode())
}
8 changes: 8 additions & 0 deletions example/simple/stub/uint64_int64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@
vint64: 72057594037927936
# {"high":18446744073709551615,"low":18446744073709551615}
vuint64: 18446744073709551615
- service: Gripmock
method: SayHello
input:
matches:
vint64: "^100[1-2]{2}\d{0,3}$"
output:
data:
message: "Regexp matched"
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/bavix/features v1.0.0
github.com/bavix/gripmock-sdk-go v1.0.4
github.com/bavix/gripmock-ui v1.0.0-alpha7
github.com/bavix/gripmock/protogen v0.0.0-20240729052235-50a4b281936f
github.com/bavix/gripmock/protogen v0.0.0-20240729213106-b0daec97f221
github.com/cristalhq/base64 v0.1.2
github.com/goccy/go-yaml v1.12.0
github.com/google/uuid v1.6.0
Expand All @@ -16,14 +16,14 @@ require (
github.com/gripmock/environment v1.0.4
github.com/gripmock/grpc-interceptors v1.0.2
github.com/gripmock/shutdown v1.0.0
github.com/gripmock/stuber v1.1.0
github.com/gripmock/stuber v1.1.1
github.com/jhump/protoreflect v1.16.0
github.com/oapi-codegen/runtime v1.1.1
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.33.0
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f
google.golang.org/genproto/googleapis/api v0.0.0-20240730163845-b1a4ccb954bf
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
)
Expand All @@ -36,7 +36,7 @@ require (
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/gripmock/deeply v1.2.0 // indirect
github.com/gripmock/deeply v1.2.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand All @@ -49,7 +49,7 @@ require (
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240725223205-93522f1f2a9f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/bavix/gripmock-sdk-go v1.0.4 h1:FDBlusqVFoy5Yo49khztYqfVt9+NSEf1mIl1n
github.com/bavix/gripmock-sdk-go v1.0.4/go.mod h1:/1cmn8VuN6Pc7ttMejqXLYpvf1CJF08ezoEA9lJIZiU=
github.com/bavix/gripmock-ui v1.0.0-alpha7 h1:0VDKdaUWgMBPURsLXtSt0FmCK4MKSxlSq+8u0ukfois=
github.com/bavix/gripmock-ui v1.0.0-alpha7/go.mod h1:XEH4YYEKL+wEDtONntoWm6JxjbVWzl7XtDYztUTBfeA=
github.com/bavix/gripmock/protogen v0.0.0-20240729052235-50a4b281936f h1:pJyxFiCrI8GBbukq50oVN0eGEqJ5LdW8aRWXu0clB0w=
github.com/bavix/gripmock/protogen v0.0.0-20240729052235-50a4b281936f/go.mod h1:3CtbEfzqLiuFdhvtEKkSwOh9ZJDtnn085OYi/ekNcug=
github.com/bavix/gripmock/protogen v0.0.0-20240729213106-b0daec97f221 h1:vBOcfq3pg42VBppNT8oHgJvV8+2OExYnWHB/eaj26GM=
github.com/bavix/gripmock/protogen v0.0.0-20240729213106-b0daec97f221/go.mod h1:gwB6G6c1ZgBTAa+AlUqByark5JO7BGXjm87FsuA0csQ=
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
github.com/bufbuild/protocompile v0.14.0 h1:z3DW4IvXE5G/uTOnSQn+qwQQxvhckkTWLS/0No/o7KU=
github.com/bufbuild/protocompile v0.14.0/go.mod h1:N6J1NYzkspJo3ZwyL4Xjvli86XOj1xq4qAasUFxGups=
Expand Down Expand Up @@ -52,16 +52,16 @@ github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyE
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gripmock/deeply v1.2.0 h1:gHiR5NoRB+RwhSNNF1Zl97BafaRr8/HOV5Bxa3YdVLM=
github.com/gripmock/deeply v1.2.0/go.mod h1:fqZtcO18v2rR9lLEJY7pgBHbTV0mrTFBYQiHOPAu9iQ=
github.com/gripmock/deeply v1.2.1 h1:cvVhOwXnFn8pEtRxl9dXCAerIMavEvMmHbGi9su3h0s=
github.com/gripmock/deeply v1.2.1/go.mod h1:fqZtcO18v2rR9lLEJY7pgBHbTV0mrTFBYQiHOPAu9iQ=
github.com/gripmock/environment v1.0.4 h1:IqyFkwZ/s5ApJz+OD4yPfax6qlGftDaQ3zOqKNRDuMc=
github.com/gripmock/environment v1.0.4/go.mod h1:nzBAHAw6/OYsng65X5q6HVmTmKtlvTHVdI/0OK1GGgQ=
github.com/gripmock/grpc-interceptors v1.0.2 h1:wNmecrDlubuSXhJyJNfTM9ydPcY6w4Pz55HNoSrWRnc=
github.com/gripmock/grpc-interceptors v1.0.2/go.mod h1:Bzh5pbb+sSC1vPmKTcEqg1jUUJFMAobQOuSKSXpMBMM=
github.com/gripmock/shutdown v1.0.0 h1:ESDCCBeNHazgAstCpIskaORNWH3b+P03a2gznW+8IFY=
github.com/gripmock/shutdown v1.0.0/go.mod h1:YwyI7uYgIPPdR9k8QNHwzDI2mQNpUSu+WT9mvqVoty4=
github.com/gripmock/stuber v1.1.0 h1:RpJ9cWP3shfyeC96phubwJlyFmXXtCxTyJRvd9bltqM=
github.com/gripmock/stuber v1.1.0/go.mod h1:3YhVm85Q30aOuYFKD0pr4Cz8Mzq66Yz8MQVx+YaZr2k=
github.com/gripmock/stuber v1.1.1 h1:6n7ml1yq1DGrDUXnGn9n7z7ExWxVENEl58Hm14Nwlbc=
github.com/gripmock/stuber v1.1.1/go.mod h1:BulrB4hoxCDH11OrdudBFHSrjAj+pPgr789lAWNwc2g=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jhump/protoreflect v1.16.0 h1:54fZg+49widqXYQ0b+usAFHbMkBGR4PpXrsHc8+TBDg=
Expand Down Expand Up @@ -171,10 +171,10 @@ golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 h1:LLhsEBxRTBLuKlQxFBYUOU8xyFgXv6cOTp2HASDlsDk=
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f h1:b1Ln/PG8orm0SsBbHZWke8dDp2lrCD4jSmfglFpTZbk=
google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f/go.mod h1:AHT0dDg3SoMOgZGnZk29b5xTbPHMoEC8qthmBLJCpys=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240725223205-93522f1f2a9f h1:RARaIm8pxYuxyNPbBQf5igT7XdOyCNtat1qAT2ZxjU4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240725223205-93522f1f2a9f/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
google.golang.org/genproto/googleapis/api v0.0.0-20240730163845-b1a4ccb954bf h1:GillM0Ef0pkZPIB+5iO6SDK+4T9pf6TpaYR6ICD5rVE=
google.golang.org/genproto/googleapis/api v0.0.0-20240730163845-b1a4ccb954bf/go.mod h1:OFMYQFHJ4TM3JRlWDZhJbZfra2uqc3WLBZiaaqP4DtU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf h1:liao9UHurZLtiEwBgT9LMOnKYsHze6eA6w1KQCMVN2Q=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
Expand Down
5 changes: 5 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gripmock/deeply v1.2.0 h1:gHiR5NoRB+RwhSNNF1Zl97BafaRr8/HOV5Bxa3YdVLM=
github.com/gripmock/deeply v1.2.0/go.mod h1:fqZtcO18v2rR9lLEJY7pgBHbTV0mrTFBYQiHOPAu9iQ=
github.com/gripmock/stuber v1.1.0 h1:RpJ9cWP3shfyeC96phubwJlyFmXXtCxTyJRvd9bltqM=
github.com/gripmock/stuber v1.1.0/go.mod h1:3YhVm85Q30aOuYFKD0pr4Cz8Mzq66Yz8MQVx+YaZr2k=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/hydrogen18/memlistener v1.0.0/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE=
Expand Down Expand Up @@ -319,6 +323,7 @@ golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
Expand Down
3 changes: 2 additions & 1 deletion internal/infra/muxmiddleware/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ func RequestLogger(next http.Handler) http.Handler {
Int("bytes", ww.bytesWritten).
Int("code", ww.status)

if err := jsondecoder.UnmarshalSlice(bodyBytes, nil); err == nil {
var result []any
if err := jsondecoder.UnmarshalSlice(bodyBytes, &result); err == nil {
event.RawJSON("input", bodyBytes)
}

Expand Down
2 changes: 1 addition & 1 deletion protogen/example/ms/ms.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions protogen/example/ms/ms_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protogen/example/multi-files/file1.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions protogen/example/multi-files/file1_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protogen/example/multi-files/file2.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions protogen/example/multi-files/file2_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protogen/example/multi-package/bar/bar.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protogen/example/multi-package/foo.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3e4d95e

Please sign in to comment.