Home > database >  How to implement mutations using nreco.graphql in dotnet application
How to implement mutations using nreco.graphql in dotnet application

Time:09-27

I am very new to Graphql and trying to implement mutations in dotnet using nreco.graphql, as of now there are no errors in the project files , when I tried to execute the mutation query am getting below error message. It says the input format what we are passing is not valid but I verified it many times and there is no error in it. So please help me to resolve the issue.

Query: mutation($TestValue:TestInput!) { ActivateInactivateUser(data:$TestValue) { Status } }

Query Variables: { "TestValue": { "UserID": "5", "UserName": "Test", "Status": "Inactive" } }

Error message: Variable '$TestValue' is invalid. Unable to parse input as a 'TestInput' type. Did you provide a List or Scalar value accidentally

CodePudding user response:

I am very new to Graphql and trying to implement mutations in dotnet using nreco.graphql, as of now there are no errors in the project file

As far as I know, NReco.GraphQL based on engine Graph.Net. When it comes to mutation queries - you can check the docs from Graph.Net team here

Error message: Variable '$TestValue' is invalid. Unable to parse input as a 'TestInput' type. Did you provide a List or Scalar value accidentally

Did you set up an appropriate model for the method "ActivateInactivateUser"? You ought to add sth like this:

public class TestInputType : InputObjectGraphType

  • Related