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

convert_camel_case_to_snake produces bad results in two cases #1209

Open
ofer-pd opened this issue Dec 10, 2024 · 2 comments
Open

convert_camel_case_to_snake produces bad results in two cases #1209

ofer-pd opened this issue Dec 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ofer-pd
Copy link

ofer-pd commented Dec 10, 2024

Currently converts as follows:

FOO_bar  ->  fo_o_bar    # would prefer foo_bar
FOO_BAR  ->  fo_o_bar    # would prefer foo_bar

Could be fixed by adding a line after: https://github.com/mirumee/ariadne/blob/main/ariadne/utils.py#L70

```python
            or (
                i < max_index
                and graphql_name[i] != c
                and graphql_name[i + 1] == lowered_name[i + 1]
                and graphql_name[ i + 1 ] != "_"        # <--- NEW LINE
            )

Thoughts?


UPDATE: I just came across another bad conversion case at work:

S3_BUCKET  ->  s_3__bucket    # would prefer s3_bucket

If there's interest in this, I can work on a patch. Otherwise, I'll just fix it for myself with a custom converter.

@rafalp
Copy link
Collaborator

rafalp commented Dec 10, 2024

Please contribute a patch, I would love to include a fix in new release I am planning sometime before xmas.

@rafalp rafalp added the bug Something isn't working label Dec 10, 2024
@rafalp rafalp added this to the Next release milestone Dec 10, 2024
@rafalp rafalp modified the milestones: 0.24, Next feature release Dec 19, 2024
@ofer-pd
Copy link
Author

ofer-pd commented Dec 20, 2024

I don't think I'll be able to get anything done before xmas - got a ton of work that needs to be finished by end of year.

I'll jump on this as soon as I can get some breathing room at work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants