Skip to content

split_words: allow numeric suffix in words #432

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

Closed
tsotnikov opened this issue May 21, 2021 · 3 comments · Fixed by #413
Closed

split_words: allow numeric suffix in words #432

tsotnikov opened this issue May 21, 2021 · 3 comments · Fixed by #413
Labels
✨ enhancement New feature or improvement

Comments

@tsotnikov
Copy link
Contributor

Currently the split_words logic does not allow numerical suffixes in words
https://github.com/triaxtec/openapi-python-client/blob/v.0.9.1/openapi_python_client/utils.py#L14-L17

Applying sneak_case for a tag like "v1" it gets transformed into "v_1" .
It may be very subjective but in my opinion is ugly, and I would prefer that resulting output after applying sneak_case would be "v1".

As changing split_words is a breaking change (and may be arguable whether the number is part of the word or not) maybe one solution could be to make the behavior of split_words configurable via config file.

@tsotnikov tsotnikov added the ✨ enhancement New feature or improvement label May 21, 2021
@dbanty
Copy link
Collaborator

dbanty commented May 21, 2021

I've had a few variations of this discussion now. Unfortunately there's no clear cut "best" way to do snake casing with numbers as sometimes it's appropriate to use a separate "word" and sometimes it's not. There is one open PR which will be landing in the next breaking version (#413) which may make the behavior better for your case? But the goals at this point around casing are more about consistency than style, since style is so subjective.

@ramnes
Copy link
Contributor

ramnes commented May 21, 2021

Yeah, #413 should keep both "V1" and "v1" as "v1" rather than "v_1".

@tsotnikov
Copy link
Contributor Author

Thanks, #413 (not splitting all lowercase strings) looks good enough for me.

@dbanty dbanty linked a pull request May 21, 2021 that will close this issue
dbanty pushed a commit that referenced this issue May 24, 2021
dbanty pushed a commit that referenced this issue Jun 2, 2021
dbanty pushed a commit that referenced this issue Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants