Skip to content

Add IProtobufDecoder extension point for custom gRPC decoding#585

Merged
haga-rak merged 1 commit into
mainfrom
feature/custom-protobuf-decoder
Mar 20, 2026
Merged

Add IProtobufDecoder extension point for custom gRPC decoding#585
haga-rak merged 1 commit into
mainfrom
feature/custom-protobuf-decoder

Conversation

@haga-rak
Copy link
Copy Markdown
Owner

@haga-rak haga-rak commented Mar 20, 2026

Summary

  • Adds IProtobufDecoder interface and ProtobufDecodeContext struct as public API for custom protobuf message decoding
  • Adds FormatSettings.ProtobufDecoder property to wire in a custom decoder
  • Includes ProtobufDecoder.Create(Func<...>) factory for delegate-based usage
  • Custom decoder is tried first, with protoc-based and raw wire-format decoding as fallbacks

This lets library consumers provide their own decoding logic (e.g., via protobuf-net.Reflection) without requiring the protoc CLI on PATH.

Test plan

  • Verify dotnet build src/Fluxzy.Core succeeds
  • Verify existing gRPC formatting tests pass with no decoder set (null by default)
  • Verify that when a custom IProtobufDecoder is set on FormatSettings, it is called before protoc-based decoding
  • Verify that returning null from IProtobufDecoder.TryDecode falls through to protoc-based and then raw decoding
  • Verify ProtobufDecoder.Create(func) correctly wraps a delegate

Allow consumers to provide their own protobuf decoding logic via
FormatSettings.ProtobufDecoder, removing the hard dependency on the
protoc CLI tool. The custom decoder is tried first, with protoc-based
and raw wire-format decoding as fallbacks.
@haga-rak haga-rak merged commit 3289a2e into main Mar 20, 2026
3 of 4 checks passed
@haga-rak haga-rak deleted the feature/custom-protobuf-decoder branch March 20, 2026 13:48
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.

1 participant