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

withAlias adds field name to alias name #61

Open
jens-josh opened this issue Dec 22, 2022 · 3 comments
Open

withAlias adds field name to alias name #61

jens-josh opened this issue Dec 22, 2022 · 3 comments

Comments

@jens-josh
Copy link

q.withAlias("alias").field();

produces the graphql:

field_alias: field

I'd expect it to produce

alias: field

See startField()
https://github.com/Shopify/graphql_java_gen/blob/master/support/src/main/java/com/shopify/graphql/support/Query.java#L66

@dylanahsmith
Copy link
Contributor

Don't you mean the alias name would end up being field__alias in your example.
It preserves the original field name so that it can be obtained on the response to parse it with this library, with the assumption that the alias is there so the field can be queried more than once.

@jens-josh
Copy link
Author

If that's by design, then maybe we can have a variant of withAlias that generates the alias as requested?

@dylanahsmith
Copy link
Contributor

That would break response parsing, which isn't done with access to the original request.

Do you have an actual use case for being able to avoid the field name prefix?

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