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

fix: camelToSnake to respect uppercase words, such as "GetAPIValue" -> "GET_API_VALUE" #1046

Merged
merged 1 commit into from
May 25, 2024

Conversation

BrandonArmand
Copy link
Contributor

Problem

camelToSnake() is converting the example string "TestAPI" -> "TEST_AP_I" when converting a 3rd party integration proto files that I am attempting to generate with the Nest option. I believe that the conversion should respect the "API" part of the string and not split it into two parts like so.

Fix

I swapped the logic to use the already imported "case-anything" library's snakeCase() function as snakeCaseAnything() and added a couple of simple tests to ensure the logic.

I would love for this fix to go through as it is a pretty inconvenient problem at the moment (:

Thanks!

@BrandonArmand BrandonArmand changed the title Fix camelToSnake to respect uppercase words, such as "GetAPIValue" -> "GET_API_VALUE" fix: camelToSnake to respect uppercase words, such as "GetAPIValue" -> "GET_API_VALUE" May 24, 2024
@stephenh
Copy link
Owner

Hi @BrandonArmand , thanks for the PR! Can you remove the package-lock.json and yarn.lock changes? Thanks!

@stephenh
Copy link
Owner

Fwiw my guess is that the build failures are because a dependency like ts-poet or prettier accidentally got unlocked/bumped to latest with the package-lock/yarn.lock changes.

@BrandonArmand
Copy link
Contributor Author

Removed package.lock and reverted yarn.lock, and squashed the commits to cleanup the git logs regarding those changes.

@stephenh
Copy link
Owner

Looks great! Thanks!

@stephenh stephenh merged commit d2e75cd into stephenh:main May 25, 2024
6 checks passed
stephenh pushed a commit that referenced this pull request May 25, 2024
## [1.176.1](v1.176.0...v1.176.1) (2024-05-25)

### Bug Fixes

* camelToSnake to respect uppercase words, such as "GetAPIValue" -> "GET_API_VALUE" ([#1046](#1046)) ([d2e75cd](d2e75cd))
@stephenh
Copy link
Owner

🎉 This PR is included in version 1.176.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants