AutoSchema, is it possible to combine (merge) queries or mutations from several classes?
See original GitHub issueHello,
I found that AddAutoSchema
was very useful for the code-first approach, but I found it not so clean to make a class contains all of the queries (and also for mutations). When number of queries and mutations grows it’s a little bit hard to manage the code.
Is it possible to group them for something like this?
public class UserQuery
{
IList<User> Users(int limit, int offset) {}
IList<User> User(int id) {}
}
public class UserMutation
{
User CreateUser(User user) {}
User UpdateUser(int id, User user) {}
bool DeleteUser(int id) {}
}
public class PostQuery
{
IList<Post> Posts(int limit, int offset) {}
IList<Post> Post(int id) {}
}
public class PostMutation
{
Post CreatePost(Post post) {}
Post UpdatePost(int id, Post post) {}
bool DeletePost(int id) {}
}
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to combine a mutation and a query in a single query?
There's no way to send a mutation and a query in one request according to the GraphQL specification. However, you can add any...
Read more >Auto schema generation · Issue #49 · graphql-python ...
This only currently generates a schema with queries, not mutations. I haven't fired it up in over a year. I hope it helps....
Read more >GraphQL schema basics
A single mutation operation can include multiple top-level fields of the Mutation type. This usually means that the operation will execute multiple back-end ......
Read more >How to Combine GraphQL Type Definitions Quickly and ...
Let's do it! You can escape a giant file like this with Queries + Mutations of different resource types lobbed together!
Read more >How to run multiple GraphQL queries and combine ...
This means you can combine data from various sources into your project so you can query them at once through your GraphQL API....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can also do without the
IQuery
and etc a bit more simply:I didn’t test all this code, but I think it will work.
Ah, I think I understand the idea. Thank you guys for the variety of answers.