Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akshayjshah/connectproto
Configurable codecs for connect-go
https://github.com/akshayjshah/connectproto
connectrpc json protobuf
Last synced: 3 months ago
JSON representation
Configurable codecs for connect-go
- Host: GitHub
- URL: https://github.com/akshayjshah/connectproto
- Owner: akshayjshah
- License: mit
- Created: 2023-04-29T21:29:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-10T11:50:34.000Z (10 months ago)
- Last Synced: 2024-06-21T14:21:14.454Z (7 months ago)
- Topics: connectrpc, json, protobuf
- Language: Go
- Homepage: https://pkg.go.dev/go.akshayshah.org/connectproto
- Size: 33.2 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
connectproto
============[![Build](https://github.com/akshayjshah/connectproto/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/akshayjshah/connectproto/actions/workflows/ci.yaml)
[![Report Card](https://goreportcard.com/badge/go.akshayshah.org/connectproto)](https://goreportcard.com/report/go.akshayshah.org/connectproto)
[![GoDoc](https://pkg.go.dev/badge/go.akshayshah.org/connectproto.svg)](https://pkg.go.dev/go.akshayshah.org/connectproto)`connectproto` allows [Connect][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`:
```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:* The [two most recent major releases][go-support-policy] of Go.
* [APIv2] of Protocol Buffers in Go (`google.golang.org/protobuf`).Within those parameters, `connectproto` follows semantic versioning.
## Legal
Offered under the [MIT license][license].
[APIv2]: https://blog.golang.org/protobuf-apiv2
[go-support-policy]: https://golang.org/doc/devel/release#policy
[license]: https://github.com/akshayjshah/connectproto/blob/main/LICENSE
[connect]: https://github.com/connectrpc.com/connect-go
[vtprotobuf]: https://github.com/planetscale/vtprotobuf