microsoft / kiota

OpenAPI based HTTP Client code generator
https://aka.ms/kiota/docs
MIT License
2.92k stars 203 forks source link

Remove normalization from writers #2842

Open andreaTP opened 1 year ago

andreaTP commented 1 year ago

Normalization of names should happen in the refiners to allow other phases to reuse the information.

Currently, Python and Ruby are performing the normalization in the writers, and this is causing a bunch of issues.

We should move the normalization back to the refiners.

sebastienlevert commented 1 year ago

@andreaTP would you be willing to take on this work?

andreaTP commented 1 year ago

Hi @sebastienlevert , sorry for the delay I was on PTO 🙂

I started looking at this issue; unfortunately, it seems more profound than I initially thought. In the ./src/Kiota.Builder/Writers/Python there are 75 occurrences of .ToSnakeCase() and, in some places, assignments are done again by mangling the name with propertyType.Name.ToFirstCharacterUpperCase().

I'll be grateful if someone in the core team is willing to tackle this. If you are short on resources I can prioritize it, but this is going to need more coordination than expected.

sebastienlevert commented 1 year ago

Invoking @baywet for chiming in here. But I agree these should happen upstream to allow for an easier use downstream.

baywet commented 1 year ago

Once the code migration is complete, we should investigate building a custom analyzer to prevent any regression.

baywet commented 1 year ago

re-opening as this still needs to be done for other languages. If you could address PHP next, it'd be great.