Skip to content

split_words: allow numeric suffix in words #432

Closed

Description

@tsotnikov

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.

Activity

  1. dbanty commented on May 21, 2021

    @dbanty
    Collaborator

    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.

  2. ramnes commented on May 21, 2021

    @ramnes
    Contributor

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

  3. tsotnikov commented on May 21, 2021

    @tsotnikov
    ContributorAuthor

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

  4. linked a pull request that will close this issueEnhance split words #413on May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions