prost
prost copied to clipboard
Feature request: allow specifying attributes for oneof fields
Currently it is possible to add attributes to oneof fields using either field_attributes
or type_attributes
, but it requires explicit knowledge of all of the oneof field paths. One of the major stumbling blocks in adding serde
attributes to prost outputs in order to serialize/deserialize from json (longstanding issue: https://github.com/tokio-rs/prost/issues/75) is getting serde(flatten)
and serde(rename_all="snake_case")
onto all oneof enums. This could be made much easier via the addition of oneof_field_attributes
and oneof_type_attributes
configuration options, which would allow usage of "."
as the path pattern. I believe that many, if not all, of these use cases could be handled in this way without prost having to explicitly support json ser/deserialization
I think that is possibly and option, I am not really happy with the current way that we support field/type attributes. I'd be happy for someone to champion this as I won't have much time to get to this anytime soon.