Dynamically Set The Return type of a query #807
Unanswered
EdgarEmmanuel
asked this question in
Q&A
Replies: 1 comment
-
Hi there, I think you also asked on slack where I already replied, but I'll replicate it here too The TL;DR is that I think you can do this with unions:
Notion that, the way this works in GraphQL is that you need to explicitly formulate all possible return types in the query: query foo(arg1:true) {
...resultTypeWithPagination {
metadata {
}
data {
}
}
...resultTypeWithoutPagination {
user
}
} HTH! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everybody , it's been four days i am trying do do something and i cam across the fact that does not exist yet so this is waht i want
what i want to do is something like that
query { users(Paginate:true,count:2,page:1){ metadata{ per_page, total }, data{ date } } }
it returns me this :
{ "data": { "users": { "metadata": { "per_page": 2 }, "data": [ { "date": "2021-14-07" } ] } } }
==========================
and when i only do this
query{ users(Paginated:false){ date } }
it returns me
{ "data": { "users": [ { "date": "2021-14-07" } ] } }
is this possible in graphQL ? and if yes is this possible how to implements is with This package ?
Beta Was this translation helpful? Give feedback.
All reactions