feat(g13b): expand the protobuf codec — enum, map, repeated#50
Merged
Conversation
ProtobufJsonCodec now covers, driven purely by the descriptor: - enum: decoded to its value name (proto3 JSON), encoded from name or number. - map<k,v>: repeated entry messages on the wire <-> a JSON object. A decoded entry value is detached from its entry before being placed in the map (a JsonNode may have only one parent — the bug that first surfaced this). - repeated: both packed scalar/enum (one length-delimited run, read until the sub-stream ends) and unpacked (repeated tags); written unpacked, which every reader accepts. Validated against WireMock + its gRPC extension with a Describe call carrying a repeated string, an enum (GREEN), and a map<string,int32> in the request and a packed repeated int32 in the reply. The same stub is served by both sides and the decoded replies match — so the request JSON Mockifyr decodes hits the stub's equalToJson exactly as the reference extension's does across these field kinds. Suite green (101 differential, 9 application). Deferred (tracked): oneof + well-known wrappers in the codec; streaming; gRPC status/error responses; gRPC admin reset. Refs: G13b Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
G13b — protobuf codec expansion (enum / map / repeated)
Deepens the gRPC vertical:
ProtobufJsonCodecnow handles the common proto3 field kinds beyond the G13a scalars, still driven purely by the descriptor.What's covered now
enum— decoded to its value name (proto3 JSON), encoded from name (or number).map<k,v>— repeated entry messages on the wire ↔ a JSON object. (A decoded entry value is detached from its entry before being placed in the map — aJsonNodemay have only one parent; that constraint is what first surfaced the map path.)Validation
G13bGrpcCodecTests.Describe_WithEnumMapRepeated_MatchesTheOracle: aDescribecall carries a repeatedstring, anenum(GREEN), and amap<string,int32>in the request, and a packed repeatedint32in the reply. The same stub is served by the oracle (WireMock + gRPC extension) and Mockifyr; the decoded replies (summary,codes) must match — proving the request JSON Mockifyr decodes hits the stub'sequalToJsonexactly as the reference extension's does across all these field kinds.Full suite: 101 differential, 9 application, 0 warnings.
Explicitly deferred (tracked)
oneof+ well-known wrapper types in the codec; client/server streaming; gRPC status/error responses; gRPC admin reset.Docs:
docs/parity/g13-grpc.md(G13b section),docs/roadmap.md(G13b ticked). The test proto/greeter.dscfixture grew aDescribemethod.🤖 Generated with Claude Code