Currently we use bytes device_id
and a custom type for device ids in the proto contracts.
That’s all fine and well on the wire, but bytes
does not translate well for consumers of APIs, because users will have no idea how to go from bytes to our magical dash separated “luhnified with a twist” string, which is what everyone actually sees and uses.
I am also not sure this plays well with grpc-gateway if you have REST paths that have bytes embedded as part of URL rules…
Hence for that reason I’d like to change the type of DeviceID
to be a string rather than bytes (in Go code).
To not break wire/db compatability, I guess I have to keep it as bytes
in bep.proto and lib/db/structs.proto, but I guess I can handle the conversions around those areas and get away with changing it to string everywhere else.
Also, I think changing the type from bytes
to string
in terms of proto spec is not a breaking change, as they are both wire type 2
which is “variable length data”, it’s just that there would be a lot of complication when going onto the wire, because you’d have to know if the other side expects a string or bytes, to deluhnify stuff before putting it on the wire.
Whats the general feeling for this? Any other ideas how to solve this?