graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

Duplicate definition of CreateSubscriptionStream extension methods

Open ducvietcao opened this issue 3 years ago • 0 comments
trafficstars

The overloads of the extension methods CreateSubscriptionStream() accepting the defineResponseType argument (allowing to use anonymous response types) are defined twice, namely:

  1. in GraphQL.Client.Abstractions.GraphQLClientExtensions
  2. in GraphQL.Client.Http.GraphQLHttpClientExtensions

This code will fail to compile:

using GraphQL.Client.Abstractions;
using GraphQL.Client.Http;
using GraphQL.Client.Serializer.SystemTextJson;

var client = new GraphQLHttpClient("http://example.com/", new SystemTextJsonSerializer());
var request = new GraphQLHttpRequest();
var defineResponseType = () => new { Foo = "" };

client.SendQueryAsync(request, defineResponseType);           // OK
client.CreateSubscriptionStream(request, defineResponseType); // CS0121: The call is ambiguous

I know that there are several ways to avoid this conflict (Don't use anonymous types / Don't import GraphQL.Client.Abstractions / Use the fully qualified method name), but I assume that this redundancy is not intended and that the second occurence should be removed, thus keeping all methods for anonymous types in the GraphQL.Client.Abstractions package.

ducvietcao avatar Dec 08 '21 20:12 ducvietcao