Open alkampfergit opened 1 year ago
@alkampfergit, what you are asking for does not conform with the Framework design guidelines, which every tool in the .NET space aims to conform with.
Why would you want that?
I know that the request is strange. I use reflection from generated C# client in a software that uses jint to let the user write JavaScript scripts.
It would be useful to have C# classes that are identical in shape with JavaScript, they would not be idiomatic, but this is really an edge situation. The library we are using generates intelligense for the user based on C# class. With a C# client generated in this way we can work seamlessly between C# and Js.
Jint by default ignores the first character casing and then is case-sensitive for the rest of them. You could probably just generate the intellisense helpers with first character lower-cased.
You could also probably just replace the default property name generator: https://github.com/RicoSuter/NJsonSchema/blob/63ee6152e9819596e9c7158a9ac634a96f73b2e9/src/NJsonSchema.CodeGeneration.CSharp/CSharpGeneratorSettings.cs#L46
Thank y for the suggestion!
Or, since you're already using reflection, use the annotation attributes to extract the JSON names.
I've searched but I was not able to find any option to generate C# client with DTO with the same casing of the API
As an example, I have an api with standard camelCase name, if I generate typescript client evertying is ok.
In typescript client, correctly all properties starts with lowercase letter. If you look at the snippet below, C# client uses only PascalName properties with the correct Newtonsoft attributes that contains properties with the correct casing.
I have a scenario where I need the real C# property to have the exact casing as I specified in swagger file.
I'd like the above C# client is generated like this
I've searched a little bit around but I was not able to find any simple solution.
What am I missing?
Thanks for any help anyone can give me.