fullstorydev / fullstorydev/grpcurl

JSON protobuf encoding doesn't respect the proper format for field masks

Open
#393 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
12.8k
Forks
580
Avg merge
1h 8m
Merged PRs (30d)
5

Description

The encoding and decoding for protobuf field masks via gRPCurl is incorrect.

The [protobuf reference](https://protobuf.dev/reference/protobuf/google.protobuf/#json-encoding-field-masks) defines a comma separate list of strings for field masks, whereas gRPCurl just maps between the JSON and protobuf as if it were any other proto and expects an array of strings under a `paths` field in an object (i.e. `repeated string paths`).

This cause problems when piping JSON decoded protos into gRPCurl.

It looks like the reason for this is that gRPCurl uses `jsonpb`, a deprecated library that doesn't feature `FieldMask` in [its `switch` for well known types](https://github.com/golang/protobuf/blob/5d5e8c018a13017f9d5b8bf4fad64aaa42a87308/jsonpb/decode.go#L146) when decoding. Whereas the more modern `protobuf-go` library [does](https://github.com/protocolbuffers/protobuf-go/blob/b8fc7706010499f46982c883add4351b12e30c0b/encoding/protojson/well_known_types.go#L52).

Would you be open to updating the encoding to `protobuf-go` given this would be a relatively notable breaking change?

Contributor guide

No contributing guide indexed for this repository

Research direction

Trace gRPCurl's JSON/protobuf encoding entry points, then compare the referenced jsonpb/decode.go handling with protobuf-go's encoding/protojson/well_known_types.go. Done means field masks follow the protobuf JSON format while preserving expected behavior for other encoded protos; the issue provides no repository test path.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.