Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle irregular camelCase to snake_case conversion #2

Open
kazk opened this issue Aug 24, 2021 · 2 comments
Open

Handle irregular camelCase to snake_case conversion #2

kazk opened this issue Aug 24, 2021 · 2 comments
Labels
blocked bug Something isn't working codegen

Comments

@kazk
Copy link
Member

kazk commented Aug 24, 2021

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.

@kazk kazk added enhancement New feature or request codegen labels Aug 24, 2021
@kazk kazk added blocked bug Something isn't working and removed enhancement New feature or request labels Oct 26, 2021
@clux
Copy link
Member

clux commented Oct 29, 2021

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.

@kazk
Copy link
Member Author

kazk commented Oct 29, 2021

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).

@clux clux added help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked bug Something isn't working codegen
Projects
None yet
Development

No branches or pull requests

2 participants