Open soundling opened 3 years ago
Typo in the operation name?
I'd also recommend to input the whole input
object as a variable...
Typo in the operation name?
I'd also recommend to input the whole
input
object as a variable...
I tried to correct the operation name, still not going thru, where could I find a proper example for mutations? I tried everything I can think of ...
I thought I had fixed it, but actually I was using an other RestSharp client, not this client... Still can"t manage to get it working ...
Well... check whats happening on the server side now... you're getting an InternalServerError
now!
In my case, I get a bad request because the title case of variable properties isn't matched.
the object I have on server is:
interface IInputPhone {
name: {
en: string
}
description: {
en: string
}
}
From client side, this GraphQLRequest
gets a Bad Request:
var gqlRequest = new GraphQLRequest
{
Query = mutation,
OperationName = "createPhoneContent",
Variables = new
{
inputPhone = new
{
Name = new
{
En = "iPhone"
},
Description = new
{
En = "iPhone test"
}
}
}
};
While this is working:
var gqlRequest = new GraphQLRequest
{
Query = mutation,
OperationName = "createPhoneContent",
Variables = new
{
inputPhone = new
{
name = new
{
en = "iPhone"
},
description = new
{
en = "iPhone test"
}
}
}
};
in my case the Input parameter is null at resolver. I'm exploring graphql for the first time, honestly i don't know what's wrong with it.
How do you handle incoming GraphQL requests in your server?
How do you handle incoming GraphQL requests in your server?
All i have is the basic configuration of graphql, im using HotChocolate 13, i'm not using app.MapEndpoints or anything related to routing, i just have app.MapGraphQL, and the mutation where i have that specific resolver is an ExtendedObjectType.
I can't help you with HotChocolate, I've never used it myself (I'm using GraphQL .NET).
But I suspect it's most likely a serialization/deserialization issue. Make sure your UserInfo
object serializes exactly to your expected JSON object (take a look at the Serializer Tests on how you might check that).
And then make sure the server correctly deserializes it again.
I can't help you with HotChocolate, I've never used it myself (I'm using GraphQL .NET).
But I suspect it's most likely a serialization/deserialization issue. Make sure your
UserInfo
object serializes exactly to your expected JSON object (take a look at the Serializer Tests on how you might check that).And then make sure the server correctly deserializes it again.
Thank you for the help ! i'll take a look at the tests !
I see that your payloads from https://github.com/graphql-dotnet/graphql-client/issues/360#issuecomment-1159765925 differ only in case so I'm sure this is a well-known problem with serialization/deserialization. Server accepts name
and description
in lower case. I've never used HotChocolate as well but in GraphQL.NET I faced the same issue sometimes.
I can't find what I'm doing wrong with mutations, simple queries are working well but I have no luck with mutations. Am I formating it properly ? Any help is welcome!