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

Snake case naming optimization #2637

Closed
wants to merge 9 commits into from
Closed

Conversation

msyyc
Copy link
Member

@msyyc msyyc commented Jun 14, 2024

fixes #2636
move to #2810

@msyyc msyyc marked this pull request as ready for review June 14, 2024 03:48
@@ -21,6 +22,9 @@ export function camelToSnakeCase(name: string): string {
.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
.replace(/_+/g, "_");

if (!name.toLocaleLowerCase().includes("constructor")) {
return Style.snake(name, false);
Copy link
Member Author

@msyyc msyyc Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With reference of m4 which also use Style of package "@azure-tools/codegen".
I also find a very interesting point in TypeScript:
image

"constrcutor" is very special word so it is not safe for if (data["constructor"]) to judge the key exists

@msyyc msyyc requested review from lmazuel and tadelesh June 19, 2024 00:25
@iscai-msft
Copy link
Contributor

@msyyc I think this PR is ready to go, I'd wait until you finish the regenerate existing packages pipeline, so we can see everything that changes

@msyyc
Copy link
Member Author

msyyc commented Jul 10, 2024

@msyyc I think this PR is ready to go, I'd wait until you finish the regenerate existing packages pipeline, so we can see everything that changes

Here is the diff caused by this PR: Azure/azure-sdk-for-python@378a646

@msyyc msyyc closed this Sep 3, 2024
@msyyc msyyc deleted the snake-case-naming-optimization branch September 3, 2024 02:23
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

Successfully merging this pull request may close these issues.

support naming optimization for snake case
5 participants