Handle irregular camelCase to snake_case conversion
kazk opened this issue · comments
Some irregular camel case to snake case conversions are failing (e.g., clusterIPs
becomes cluster_i_ps
). But prost_build
doesn't provide a way to fix this at the moment.
Is there an upstream issue for this? Had a bit of a look, and nothing matching AFAIKT. But I did see people saying they could inject serde annotations to certain types in the config with https://docs.rs/prost-build/0.9.0/prost_build/struct.Config.html#method.type_attribute :
let mut config = prost_build::Config::new();
config.type_attribute(".", "#[derive(Serialize)]");
config.type_attribute(".", "#[serde(rename_all = \"camelCase\")]");
also there are people looping* over the output to do stuff (here just a rename) we could in the worst-case to a search and replace on the file :|
Anyway, if there is no upstream issue for this we should raise one if needed.
I don't think so. tokio-rs/prost#207 is kind of similar (preserving the original name can be done by passing an identity function).