Hello guys,
At my company, our apis uses camelCase for all dictionnaire keys in json request and response bodies. That's a company guideline that came from the fact we communicate with several API's written in diverse languages. Since camelCase is the way variables are written in JS, we chose that.
This awesome library is quite useful for us. I'm using it, but before every request and every response I have to transform my dict.
Maybe you should support a camelCase mode just like Serde does
I'm not clear how pydantic needs to change. Can't you just set the attribute/field names to be camel case?
I like PEP8, If I rename properties names I can't follow it.
Besides my own classes, the json errors returned by pydantic are written snake_case.
I would appreciated a "camelCase" mode for the same reason serde.rs support it: because of naming conventions are important. And transform every key is boring and inneficient.
Humm, you can already have alternative names using config fields. But it would be possible to add such a setting or allow you to easily override the base model. I'll look into it.
this should be fixed by #165, I've included a test showing how you would use get_field_config to apply camel case.
Let me know if that works and if so I'll merge and deploy in a couple of days.
ping @dnp1, does #165 satisfy your requirement?
@samuelcolvin , yes, it helped me!!
I'm sorry I could not ping before.
But now I'll use your feature again.
Pleased it helped.
Most helpful comment
Pleased it helped.