Skip to content

feat(g13b): expand the protobuf codec — enum, map, repeated#50

Merged
omercelikdev merged 1 commit into
mainfrom
feat/g13b-grpc-codec
Jul 4, 2026
Merged

feat(g13b): expand the protobuf codec — enum, map, repeated#50
omercelikdev merged 1 commit into
mainfrom
feat/g13b-grpc-codec

Conversation

@omercelikdev

Copy link
Copy Markdown
Owner

G13b — protobuf codec expansion (enum / map / repeated)

Deepens the gRPC vertical: ProtobufJsonCodec now 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 — a JsonNode may have only one parent; that constraint is what first surfaced the map path.)
  • repeated — both packed scalar/enum (one length-delimited run, read until the sub-stream ends) and unpacked (repeated tags); written unpacked, which every protobuf reader accepts.

Validation

G13bGrpcCodecTests.Describe_WithEnumMapRepeated_MatchesTheOracle: a Describe call carries 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 the oracle (WireMock + gRPC extension) and Mockifyr; the decoded replies (summary, codes) must match — proving the request JSON Mockifyr decodes hits the stub's equalToJson exactly 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.dsc fixture grew a Describe method.

🤖 Generated with Claude Code

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>
@omercelikdev omercelikdev merged commit 654077a into main Jul 4, 2026
2 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.

1 participant