Skip to content

GraphQL.GraphQLResponse.Data Does Not Get Populated #265

@alex-leroux

Description

@alex-leroux

Hi,

I have implemented a GraphQL server using the GraphQL 2.4 (https://github.com/graphql-dotnet/graphql-dotnet) package, as per this sample: https://www.red-gate.com/simple-talk/dotnet/net-development/building-and-consuming-graphql-api-in-asp-net-core-3-1/

I returns results like this:
GraphiQL

Now I am trying use GraphQL.Client 3.1.4 to execute queries against this server, as per the sample provided at https://github.com/graphql-dotnet/graphql-client. However, I find that the GraphQLResponse.Data is never populated. My response type is defined like this for example query above:

public class AuthorResponse
{
	public Author author { get; set; }
}
public class Author
{
	public int id { get; set; }
	public string firstName { get; set; }
	public string lastName { get; set; }
}

Looking at the source code, it appears that the provided serializer, GraphQL.Client.Serializer.Newtonsoft.NewtonsoftJsonSerializer, cannot populate it, unless the response were somehow wrapped in a GraphQLResponse shaped wrapper.

What am I doing wrong?
How is this supposed to work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions