question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Execute mutation without paramters?

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lukemurraycommented, Jun 10, 2020

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.

1reaction
lukemurraycommented, Jun 4, 2020

There is a beta2 with the attribute. Will make non beta in a few days

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found