RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.24k forks source link

NSwagStudio keeps inverting the first letter of property names no matter what I do #2222

Open azimuthdeveloper opened 5 years ago

azimuthdeveloper commented 5 years ago

NSwagStudio (latest) is producing a typescript client with camel cased properties. I'm migrating from hand-typed classes and clients to nswag generated clients and this is making a lot of stuff break.

I'm generating my client classes from a Swagger Specification. Changing 'Type Style' from Class to Interface fixes the camelcasing issue, but also leaves out other details from the client class.

Is there any way to generate a TS client that doesn't automatically camel case the properties? It seems weird that there isn't an option for this in the GUI.

RicoSuter commented 5 years ago

This is by design to have the property names in line with javascript/typescript naming rules.. But you can provide a IPropertyNameGenerator to change that (but not via CLI)

azimuthdeveloper commented 5 years ago

Okay cool, so how would someone do that? How would I provide a IPropertyNameGenerator to achieve the casing that I'm after? Thanks for the help :)