For Apollo preset, you often get types that look like such.
GetUserTransactionsGetUserTransactionsByUserId
It鈥檚 how it gets generated for a query like that.
query GetUserTransactions {
getUserTransactionsByUserId {
id
}
}
I understand that it's a complicated question since the named query can have many fields/queries, hence just using GetUserTransactions, a name of the query, for type name is dangerous and not reliable. That leads to the fact that naming is hard 鈩笍 and it's especially hard when you should generate it on the fly and reliably.
Scenario, when you call multiple queries in one query, is rather rare I think, cause people to tend to split it sometimes to 2-3 requests instead since one query can be way faster than the other, so it makes sense to split them and show multiple loaders. e.g loader for a sidebar, main menu, and some footer.
Anyway, I don't have that much of the complex usage of GQL to decide for everyone, so please let's discuss and try to find a solution for that.
Thanks @RIP21 .
We are considering now to change the entire output and to avoid creating type per each selection set (and use Pick, similar to what we did in the flow-documents template). This way we will be able to generate output without any namespace at all, and even remove the noNamepsaces config.
@dotansimha Do you possibly have any news regarding this? It's the pretty much only issue that's holding me back from switching over to Babel TypeScript implementation as it's much easier to configure tools with it and it even seems to be faster.
I am considering to tweak generator to generate multiple files for each query document and that way I can drop namespace in there. But it feels rather overwhelming to get it right.
We removed namespaces completely in the recent refactor. we will release it soon.
Fix available in 1.0.0 馃憤
Most helpful comment
@dotansimha Do you possibly have any news regarding this? It's the pretty much only issue that's holding me back from switching over to Babel TypeScript implementation as it's much easier to configure tools with it and it even seems to be faster.
I am considering to tweak generator to generate multiple files for each query document and that way I can drop namespace in there. But it feels rather overwhelming to get it right.