Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SnakeCaseNameRewriter with word ending with a digit #27

Open
verdie-g opened this issue May 23, 2020 · 6 comments
Open

SnakeCaseNameRewriter with word ending with a digit #27

verdie-g opened this issue May 23, 2020 · 6 comments
Milestone

Comments

@verdie-g
Copy link

SnakeCaseNameRewriter should rewrite Abc1Def as abc1_def but rewrites it as abc1def.

@roji
Copy link
Member

roji commented May 23, 2020

/cc @YohDeadfall

@YohDeadfall
Copy link
Contributor

While this looks right in your case, it doesn't in other. For example, Xml2Linq should be translated as xml_2_linq or as xml2linq. There is no rule how translation should work, but .NET got System.Text.Json as a standard JSON serializer, and there is a feature request to support the snake case naming policy. It's blocked by some open questions, but when it happens, I will finish the work and transfer the same logic back to Npgsql and naming conventions.

/cc @layomia

@roji roji added this to the Backlog milestone May 23, 2020
@aneves
Copy link

aneves commented Oct 16, 2020

Chiming in with another use or test case: Custom3dModel.

@YohDeadfall YohDeadfall removed their assignment Feb 17, 2021
@gojanpaolo
Copy link

Our use case CustomList1OptionId

@aktxyz
Copy link

aktxyz commented Feb 12, 2022

just a data point .... a popular nuget package called Humanizer

"Abc1Def".Underscore(); 
// results in abc1_def

https://github.com/Humanizr/Humanizer#underscore

@buvinghausen
Copy link

just a data point .... a popular nuget package called Humanizer

"Abc1Def".Underscore(); 
// results in abc1_def

https://github.com/Humanizr/Humanizer#underscore

This is the right answer....

Every snake case conversion drops underscores in before the capital letters except the first one

HelloWorld1 => hello_world1
Xml2Linq => xml2_linq
XmlV2Row6 => xml_v2_row6

If you need it to be xml2linq then name your property Xml2linq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants