Releases: webrpc/gen-golang
Releases · webrpc/gen-golang
v0.14.2: Expose as Go module
Expose as Go module with //go:embed FS
v0.14.1
Fixes context propagation to HTTP requests.
v0.14.0
What's Changed
- Support enum strings by @LukasJenicek in #53
- Fix potential panic on multiple return values by @VojtechVitek in #55
- Add an extra condition in WebRPCError.Is to check against target nil … by @alinz in #54
- Regenerate examples by @VojtechVitek in #56
- Support webrpc SSE streaming by @VojtechVitek in #52
- Render godocs from parsed comments by @LukasJenicek in #57
New Contributors
Full Changelog: v0.13.7...v0.14.0
v0.13.7: Introduce .Is() method on enums
v0.13.5: Add missing reflect import when -fixEmptyArrays is used
- Add missing reflect import when -fixEmptyArrays is used
v0.13.4: Implement server OnError() hook
- Implement server OnError() hook (#46)
Example:
rpcServer := proto.NewVideoServer(app.Rpc)
rpcServer.OnError = func(r *http.Request, err *proto.WebRPCError) {
ctx := r.Context()
// Log error with request log
httplog.LogEntrySetField(ctx context.Context, "webrpcError", err.Error())
// Report crucial DB errors to Sentry
var pgErr *pgconn.PgError
if errors.As(err, &pgErr) {
// https://www.postgresql.org/docs/16/errcodes-appendix.html
if strings.HasPrefix(pgErr.Code, "42") {
sentry.CaptureException(err)
}
}
// Add requestID to error message itself.
rpcErr.Message = fmt.Sprintf("%s (requestID: %v)", rpcErr.Message, middleware.GetReqID(ctx))
// Hide error details from users in production.
if app.Config.Environment.IsProduction() {
rpcErr.Cause = ""
}
}
v0.13.3
- Switch to .WithCause() in the generated code
- Implement
err.WithCause()
, a shorter version ofproto.ErrorWithCause()
- Deprecate
proto.ErrorWithCause()
- Implement
-errorStackTrace
opt-in option (errors with stack traces reflect-compatible with github.com/pkg/errors / golang.org/x/xerrors / golang.org/x/exp/errors) - Improve formatting
- Generates less server code
- Implements Allow header per RFC 9110
- Implements
-fixEmptyArrays
option to force empty array[]
instead ofnull
in JSON - Removes deprecated
ioutils
pkg - Adds support for type meta to service method arguments
v0.13.2
- Implement
err.WithCause()
, a shorter version ofproto.ErrorWithCause()
- Deprecate
proto.ErrorWithCause()
- Implement
-errorStackTrace
opt-in option (errors with stack traces reflect-compatible with github.com/pkg/errors / golang.org/x/xerrors / golang.org/x/exp/errors) - Improve formatting
v0.13.1
v0.12.5
Fix Enum generated method receiver (#30)