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

Querying camelCase but receiving snake_case #36

Open
donni106 opened this issue Jun 19, 2020 · 4 comments
Open

Querying camelCase but receiving snake_case #36

donni106 opened this issue Jun 19, 2020 · 4 comments

Comments

@donni106
Copy link

donni106 commented Jun 19, 2020

Aliases are working fine. I can rename things in my query. But the bad thing is, that in the result everything is snake_cased.

Is this line responsible for that?

filtered_results[underscore(field_name)] = filter_keys_on_data(value, caller_id)

Is the underscore necessary?
I am processing the resulting data in JavaScript with an existing code, based on camelCase data.
There was a different GraphQL server before. Now I am merging things together with your package and encountered the problem.

@d12
Copy link
Owner

d12 commented Jun 22, 2020

Hey @donni106 , We underscore because that's the convention in Ruby when parsing GraphQL results. I can see the usecase for non-underscored results though, I can look into putting some sort of optional functionality together soon. Or, if you have time, feel free to PR :)

@donni106
Copy link
Author

It would be nice, if we could find an optional way.
For now, I am transforming the keys with deeply renaming them in the frontend before accessing the resulting data.

@d12
Copy link
Owner

d12 commented Jun 30, 2020

I should be able to get to this in the next few days

@d12
Copy link
Owner

d12 commented Sep 14, 2020

This fell off my radar for a bit, I don't have a ton of time right now for non-functional or non-significant changes, but this should be an easy PR if anyone wants to add a camelCase config option.

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

No branches or pull requests

2 participants