octokit / octokit.graphql.net

A GitHub GraphQL client library for .NET
MIT License
145 stars 50 forks source link

[BUG]: Sub-queries in GraphQL use C# type names not GraphQL entity names #298

Closed jMarkP closed 1 year ago

jMarkP commented 1 year ago

What happened?

When creating a query which generates subqueries, e.g.

new Query()
                .RepositoryOwner("foo")
                .Repositories()
                .AllPages(100)
                .Select(x => x.Name)

The generated GraphQL for subqueries uses the C# type name for, e.g. the RepositoryOwner entity type:

query($__id: ID!, $__after: String) {
  node(id: $__id) {
    __typename
    ... on StubIRepositoryOwner {
      repositories(first: 100, after: $__after) {
        pageInfo {
          hasNextPage
          endCursor
        }
        nodes {
          name
        }
      }
    }
  }
}

(See the StubIRepositoryOwner isntead of the expected RepositoryOwner)

Versions

Running from HEAD

Relevant log output

No response

Code of Conduct

jMarkP commented 1 year ago

Similar to #165