Return multiple entities from mutation?
See original GitHub issueThanks for resolving #50 so fast!
But now i have a new issue. I have the following mutation:
[GraphQLMutation]
public async Task<Expression<Func<DatabaseContext, IQueryable<Device>>>> ScanForDevices(Empty parameters, IJobManager jobManager)
{
var ids = await jobManager.StartWaitAsync<IEnumerable<int>, IDetectDeviceCommand>(ddc => ddc.ScanAsync()).ConfigureAwait(false);
return ctx => ctx.Devices.Where(x => ids.Contains(x.Id));
}
Where i try to return multiple Devices, but the schema only seems to indicate that i want to return 1.
{
"name": "scanForDevices",
"description": null,
"args": [],
"type": {
"kind": "OBJECT",
"name": "Device",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
I guess my expected output is: (If this is valid GraphQL)
{
"name": "scanForDevices",
"description": null,
"args": [],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Device",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
graphql multiple mutations using prior mutation return ...
I understand that mutations are sequential, so it makes sense to me that if Mutation 1 creates an entity and returns an id,...
Read more >Is it possible to return two "things" from a graphql mutation ...
Hey Alex - yeah absolutely. You can return whatever you want from a GraphQL mutation as long as you specify it in the...
Read more >Multiple Mutations in a Request | Hasura GraphQL Docs
If multiple mutations are part of the same request, they are executed sequentially in a single transaction. If any of the mutations fail,...
Read more >How to Return Multiple Entities in JPA Query
In this short tutorial, we'll see how to return multiple different entities in JPA Query. First, we'll create a simple code example ...
Read more >What is a mutation? - GraphQL Tutorials
When the mutation modifies multiple objects, it can return all of those objects · Mutations can't return modified types directly · To make...
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 FreeTop 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
Top GitHub Comments
Pushed a fix for this. beta3 too.
Having a look at this now, it seems along the way I have mixed a few things. 1. needing to know the singular type e.g.
Movie[] -> Movie
for things like looking up fields onMovie
and knowing the actual type e.g.Movie[]
. Going to try to clean this up