Skip to content

Allow customization of server and client codecs#192

Merged
anuraaga merged 2 commits intoconnectrpc:mainfrom
anuraaga:codec-customization
Mar 28, 2026
Merged

Allow customization of server and client codecs#192
anuraaga merged 2 commits intoconnectrpc:mainfrom
anuraaga:codec-customization

Conversation

@anuraaga
Copy link
Copy Markdown
Collaborator

@anuraaga anuraaga commented Mar 27, 2026

Fixes #189

This allows setting the list of codecs supported by a server and the codec used by a client. It accepts a breaking change to the proto_json bool that has always known it wasn't the right knob for the job.

This should satisfy use cases like customizing JSON marshaling. I considered adding parameters to ProtoJSONCodec to correspond with MessageToJson, but have left it for the future as it's not hard to copy it and provide the parameters directly.

In terms of allowing different protobuf runtimes, the core runtime only depends on google.protobuf outside of codecs for error details. I think it can be possible to abstract that but will do that independently of this change to provide the basic functionality.

@anuraaga anuraaga requested a review from stefanvanburen March 27, 2026 04:56
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
@anuraaga anuraaga force-pushed the codec-customization branch from 192ad7c to 9c14bba Compare March 27, 2026 04:56
@anuraaga anuraaga requested review from a team and removed request for stefanvanburen March 27, 2026 04:57
Copy link
Copy Markdown
Member

@stefanvanburen stefanvanburen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, that was easier than I thought it would be.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, unrelated: I think we need connectrpc.protocol here as well to render the ProtocolType:

Image

Can be a follow-up.

Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
@anuraaga anuraaga merged commit 863d4d1 into connectrpc:main Mar 28, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Customization of codecs

2 participants