Open nathanperkins opened 3 months ago
Moved from https://github.com/googleapis/google-api-go-client/issues/2686
cc: @codyoss
I think a small code example could be helpful here.
I think a small code example could be helpful here.
Thanks, added a small example.
Is your feature request related to a problem? Please describe.
We would prefer that Firebase serializes our objects in a way that is consistent with the JSON or YAML representation and with the JSON style guide.
We use proto to define and generate some of our request structs. We store the request as a field on one of our objects which is then stored in Firebase. These fields use property keys which don't align with the other object fields because the proto generated structs have
json
tags but nofirebase
tags. The default golang representation does not match the JSON style guide.There is no built-in mechanism for proto to generate arbitrary struct tags, and the feature is rejected by the go proto team. This comment from 2016 shows another engineer having the same exact problem as us.
Besides this issue, it is very, very common for structs to have
json
oryaml
tags defined. When Firebase ignores those tags, it uses an object representation which doesn't align with the other way those structs are being serialized. We would like it to be consistent.This issue is particularly problematic for services which involve multiple languages, since the default representation may differ.
Describe the solution you'd like
Allow users to configure the client library in a way that it uses the
json
oryaml
tags when afirebase
tag is not present. This is a breaking change so it must be opt-in.Example:
Results in a document which has
baz
as a key, instead of the go language defaultBar
.Describe alternatives you've considered
Setting the
firebase
tag on our protos.Caveats: