graphql-dotnet / graphql-dotnet/graphql-client

Duplicate definition of CreateSubscriptionStream extension methods

Open
#375 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
648
Forks
136
PR merge metrics
No merged PRs in 30d

Description

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`](https://github.com/graphql-dotnet/graphql-client/blob/v4.0.1/src/GraphQL.Client.Abstractions/GraphQLClientExtensions.cs#L41-L53)
2. in [`GraphQL.Client.Http.GraphQLHttpClientExtensions`](https://github.com/graphql-dotnet/graphql-client/blob/v4.0.1/src/GraphQL.Client/GraphQLHttpClientExtensions.cs#L30-L44)

This code will fail to compile:
```csharp
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.