Skip to content

akshayjshah/connectproto

Repository files navigation

connectproto

Build Report Card GoDoc

connectproto allows Connect users to customize the default JSON and binary codecs. It also includes support for the optimized marshaling methods generated by vtprotobuf.

Installation

go get go.akshayshah.org/connectproto

Usage

Use this package's options just like the ones built into connect-go:

opt := connectproto.WithJSON(
  protojson.MarshalOptions{UseProtoNames: true},
  protojson.UnmarshalOptions{DiscardUnknown: true},
)

// The pingv1connect package is generated from your Protocol Buffer schemas
// by protoc-gen-connect-go. You can use connectproto options with 
// both handlers and clients.
route, handler := pingv1connect.NewPingServiceHandler(
  &pingv1connect.UnimplementedPingServiceHandler{},
  opt,
)
client := pingv1connect.NewPingServiceClient(
  http.DefaultClient,
  "https://localhost:8080",
  opt,
)

Status: Unstable

This module is unstable, with a stable release expected before the end of 2023. It supports:

Within those parameters, connectproto follows semantic versioning.

Legal

Offered under the MIT license.