k8s-pb
                                
                                 k8s-pb copied to clipboard
                                
                                    k8s-pb copied to clipboard
                            
                            
                            
                        Handle irregular camelCase to snake_case conversion
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. https://github.com/tokio-rs/prost/issues/207 is kind of similar (preserving the original name can be done by passing an identity function).
Looking at this again. We can indeed mass replace known broken names at the end.
I did this for the type names in https://github.com/kube-rs/k8s-pb/pull/49 for alignment with type names in k8s-openapi, so i think it makes more sense now.