Marwes / schemafy

Crate for generating rust types from a json schema
MIT License
242 stars 51 forks source link

Handle underscore fields #48

Closed bemyak closed 3 years ago

bemyak commented 3 years ago

And a few other edge cases.

Rust is not happy when there is more than one underscore in a row in a field name. This can happen when transforming a name like thieves' tools: one underscore replaces the ' and the other one the space.

Another edge case is when the field name is just _. .to_snake_case() will just leave it empty, so it's better to replace is with some placeholder and return early.