NeVeSpl / NTypewriter

File/code generator using Scriban text templates populated with C# code metadata from Roslyn API.
https://nevespl.github.io/NTypewriter/
MIT License
119 stars 25 forks source link

ID in ToCamelCase not correct #70

Open EagleTsui opened 1 year ago

EagleTsui commented 1 year ago

ID in ASP.net core will be translated to id when config json in camel case but NTypewriter will be translated iD.

Tristan10 commented 1 year ago

See #35 related to this issue.

I have the following custom function which will guarantee that the casing will always match .NET. Personally I think this should be used as default.

public static string GetJSONCamelCase(string value)
{
    return System.Text.Json.JsonNamingPolicy.CamelCase.ConvertName(value);
}
xumix commented 5 months ago

It does not look like System.Text.Json is available in source generators at least изображение

NeVeSpl commented 5 months ago

It is not officially supported, but it should be available. But which version of it is available depends on VS and what is loaded to VS app domain.