Snake Case Field Option
See original GitHub issueIs your feature request related to a problem? Please describe.
OpenAPI or JsonSchema may describe key
of objects as camelCase
.
But, attributes of python should be snake_case.
The generator should provide a feature that converts filed names CamelCase
to sanke_case
.
Describe the solution you’d like I would the feature give the generator a command-line option
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Snake case - Wikipedia
Snake case (stylized as snake_case) refers to the style of writing in which each space is replaced with an underscore (_) character, and...
Read more >What is snake case? - TheServerSide.com
Snake case, or snake_case, is a naming convention that allows a developer to create white space between words in code with an underscore....
Read more >Camel Case vs. Snake Case vs. Pascal Case - Khalil Stemmler
Snake case (also referred to as underscore case) is when all the letters of the word are lower case but delimited by an...
Read more >Snake case property names - Json.NET
Snake case property names. This sample uses a SnakeCaseNamingStrategy specified using a contract resolver to snake case serialized property names.
Read more >Ability to create a snake_case field with the graphql_object ...
a way to create snake_case fields should be provided. ... All this is about is a option to disable the automatic camel case...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Maybe I am off base here but I feel like this is doing the opposite of what I am exepcting.
where I was expecting to have
Since javascript and json is usually camel case, and python is usually snake case.
EDIT: reading through https://github.com/samuelcolvin/pydantic/issues/565 it looks like pydantic is taking the approach that the constructor is taking in the camel case version. It is still odd that the
json
does not return the public verions.I implemented this here:
https://github.com/FlorianLudwig/pdk8s/blob/master/pdk8s/gen_k8s.py#L59
By changing the name to camel_case and keeping the old name as alias.