Closed ggabriel96 closed 3 years ago
Thank you.
You are right. The same limitation that prevents this lib from transforming value also applies to transforming fields. This library works with plain objects that are received / sent. There are no wrapper getters / setters that could use a different name for reading / writing using a different naming.
Think about how would you do it by hand in an Angular application to consume an API with snake_case fields while internally working with camelCase fields. The only way would be to wrap every possible object in the request / response graph to a class. And that's too much work for non-trivial models.
So, sorry, this wouldn't ever be supported.
Alright. Thanks for the quick response! :)
Hello there!
I'm currently using the OpenAPI Generator, but I have a problem when generating a TypeScript client for a Python backend. The thing is that
snake_case
is used in Python, whilecamelCase
is used in TypeScript, and their Angular generator does not handle automatically converting these attributes (some do, but not the specific for Angular).So I found this library and am considering using it, but I noticed that the generated models also keep the original name of the attributes. And in the read-me of this project there is a list of limitations with the following item:
Does this mean that this feature will not be supported? It only mentions types, not names, and I didn't find any mention of such a feature, so I'm not sure.
Just to be clear, the feature would require generating the models with
camelCase
instead of the original naming convention and then adding some mapping from the original names to the new names. That mapping would be used right before a request is sent to the backend and right before returning the backend response to the caller.By the way, very nice and clean code generation :)