-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
https://google.aip.dev/161 says that for a field of type map (e.g. map<string, string>), we may allow field masks in requests that traverse into the map, e.g.
// Reviews for the back cover. The key is the author of the review,
// and the value is the text of the review.
//
// Valid field masks: reviews, reviews.smith, reviews.`John Smith`
map<string, string> reviews = 2;
We use this in some places in our application.
However, I find that the FieldMask protojson implementation in go:
- Rejects keys that have underscores (we must camel case the keys as if they are proto fields). This causes identification issues for a map with e.g. both the keys
john_smithorJohnSmithas the only protojson field mask that will pass validation isreviews.johnSmithwhich deserialises toreviews.john_smith. - The backtick notation (`) described in that API under "Map fields" does not work.
It seems the relevant code is here:
golang/protobuf/v2/encoding/protojson/well_known_types.go
I haven't been able to find a specification for FieldMask in protojson that says authoritatively what it should/should not accept. Can you clarify? Are the AIPs recommending things the proto spec can't support? Is there a problem with the go protojson implementation?
Using google.golang.org/protobuf v1.36.5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels