Execute mutation without paramters?
See original GitHub issueI have a mutation without any parameters seems impossible to execute? (most likely its my GraphQL knowledge is lacking)
The following yields Missing bracets for mutation call scanForDevices
.
mutation test {
scanForDevices {
id
}
}
The following yields Error: line 2:17 extraneous input ')' expecting {1..11, 49}
.
mutation test {
scanForDevices() {
id
}
}
I have tried both with a empty parameter/arguments class and with no parameter/arguments class at all.
Method:
[GraphQLMutation]
public async Task<Expression<Func<DatabaseContext, IQueryable<Device>>>> ScanForDevices(DatabaseContext databaseContext, 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));
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Graphql mutations without arguments
In terms of arguments, there's nothing special about either query or mutation -- they are both fields themselves, and therefore can accept (or ......
Read more >Graphql mutations without input args did't work - General
I created a NestJS sample, I add a Mutation to sync user info to my backend. And added the following codes, the @GqlUser...
Read more >Mutations in Apollo Client - Apollo GraphQL Docs
Executing a mutation. The useMutation React hook is the primary API for executing mutations in an Apollo application. To execute a mutation, you...
Read more >[Question] How to create a mutation without input field? #653
It just has one argument, needs less code, sometimes easy to write. But I want it seems like a function with some arguments....
Read more >Mutations and Input Types
But in many cases, you will find a number of different mutations that all accept the same input parameters. A common example is...
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
I follow, this repo generates it with
()
. I don’t think it should. The spec isn’t really clear. GraphiQL does process either. going with no brackets.There is a
beta2
with the attribute. Will make non beta in a few days