-
-
Notifications
You must be signed in to change notification settings - Fork 804
Description
Product
Strawberry Shake
Is your feature request related to a problem?
I don't know if this is possible as I haven't found any documentation related to this. But I would like to be able to group graphql queries by a subtype when generating a client.
For example, I have a server that expose a graphql endpoint, as part of my Queries available on said server I have a ListUsers and a ListRoles query.
Now I have a client project, in which I do all the Strawberry shake tooling shenanigans to fetch the sdl, and generate a client. And lets also assume I have created two *.graphql files. i.e. Users.graphql and Roles.graphql each with their respective query definitions.
The client that is generated, lets call it MyApiClient, will directly have two functions ListUsers and ListRoles, as defined in the *.graphql files I mentioned above. Now in a small situation this is fine, however, as the number of queries increase this clients starts becoming quiet bloated, and it would be nice to have those functions under a sub property on the the client. e.g. instead of calling MyApiClient.ListUsers it would be MyApiClient.Users.ListUsesrs
The solution you'd like
Would it be possible to have the source code generator pick up the name of the file (semantics around naming convention aside) and use that as a sub-property on the client.
So using my example above, all my queries defined in my Users.graphql file would be referenced under MyApiClient.Users.<xyz> and so on.
The way I have semi-achieved this at the moment is at the client level. Where in my project, I have defined mulitple graphql templates all from the same source, and just define limit the query files that it uses.
So at the moment my project has MyUsersApiClient and MyRolesApiClient. Which I don't hate, other than the fact that I have to ensure multiple sdls are kept up-to-date.