Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parameterized queries with enum arguments #130

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gao-artur
Copy link
Contributor

Consider the following schema

type Device {
  enabled: Toggle
  name: String
}

enum Toggle {
  DISABLED
  ENABLED
}

type Query {
  devices(isEnabled: Toggle): [Device!]!
}

And the following query

var queryBuilder = new QueryQueryBuilder()
    .WithParameter(new GraphQlQueryParameter<Toggle?>("isEnabled"))
    .WithDevices(new DeviceQueryBuilder()
            .WithName()
            .WithEnabled(),
        new GraphQlQueryParameter<Toggle?>("isEnabled"));

This throws exception

System.ArgumentException: value required (Parameter 'graphQlTypeName')
    at SampleServer.GeneratedGraphqlClient.QueryBuilderParameter`1.EnsureGraphQlTypeName(String graphQlTypeName) in C:\SampleServer.Tests\GeneratedGraphqlClient.cs:line 454
   at SampleServer.GeneratedGraphqlClient.QueryBuilderParameter`1..ctor(String name, String graphQlTypeName) in C:\SampleServer.Tests\GeneratedGraphqlClient.cs:line 438
   at SampleServer.GeneratedGraphqlClient.GraphQlQueryParameter`1..ctor(String name, String graphQlTypeName) in C:\SampleServer.Tests\GeneratedGraphqlClient.cs:line 472
   at SampleServer.Tests.Tests.Test() in C:\SampleServer.Tests\Tests.cs:line 15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant