-
-
Notifications
You must be signed in to change notification settings - Fork 565
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
Include aliases in query plan #1072
Comments
I think the purpose of the query plan is to allow the server to make decisions on how to resolve the query efficiently. Given aliases are given by the client and transparently handled by the execution engine of this library, they do not seem useful to include. |
yes, but since each alias can have different arguments like in my example. Here it just returns the argument of the last schemesCount property. |
Right, that is misleading. {
"fields": {
"schemesCount": {
"type": "Int",
"aliases": [
{
"fields": [],
"args": {}
},
{
"fields": [],
"args": {
"status": "APPROVED"
}
},
{
"fields": [],
"args": {
"status": "CLOSED"
}
},
]
}
}
} |
maybe include the alias name in there for good measure |
We are having the same issue. We use the queryPlan to dynamically build an ElasticSearch query. Some fields have quite some possible arguments, therefore we want to be able to alias those fields. Unfortunately, the only alternative for now is duplicating these fields. |
I needed this too, so I have modified the lib to get this feature. I use it as follow: => In My Query Resolver : $aliasArgs = $info->lookAhead()->aliasArgs(); => In My Type Resolver : I did it this way because it was the quickest and easiest way to produce this feature, so don't hesitate if you have a better idea! |
Ofc, this code is an example and is not enough, you have to manage the no alias case :) |
Finally, I have modified the feature, and now it can be used with a method of ResolveInfo : getFieldSelectionWithAliases() Basic example usage for a level 1 field:
It has been merged with tag 15.19.0 |
Running lookAhead with queryplan with this query:
Gives us:
I suspect all fields should be included somehow in the result!
The text was updated successfully, but these errors were encountered: