Skip to content

Allow union match with base interface #115

Description

@robbss

Is your feature request related to a problem? Please describe.

When selecting a union type, it's not possible to match via a base interface, this prevents us from matching on Error to determine if any error happened.

Describe the solution you'd like
Given the schema:

interface Error {
  message: String!
}

type NotFoundError implements Error {
  message: String!
  code: String!
}

union UpdateTripError = NotFoundError

type UpdateTripPayload {
  trip: Trip
  errors: [UpdateTripError!]
}

I would like to be able to generate a query equivalent to:

updateTrip($input) {
  trip {
    comment
  }
  errors {
    ... on Error {
      message
    }
  }
}
graphClient.Mutation(q => q.UpdateTrip(..., o => new { Error = o.Errors(oo => oo.On<Error>().Select(ooo => ooo.Message)) }));

This is currently not possible, due to Error not being part of the union type UpdateTripError.

The query does work when queried directly against the GraphQL backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions