jcward / haxe-graphql

Utilities for working with Haxe and GraphQL.
MIT License
23 stars 6 forks source link

Support for __typename queries #43

Open skilgoreT opened 9 months ago

skilgoreT commented 9 months ago

For types with union type payloads, request support for __typename universal query syntax

enum ContentModuleType 
{
  POLL
  TASKLIST
}
type TaskListModule {
  content_type: ContentModuleType!
  tasklist_id: ID!
}
type PollModule {
  content_type: ContentModuleType!
  poll_id: ID!
}
union ContentModule = PollModule | TaskListModule

########################
# Queries and Mutations
########################
extend type Query
{
  content_module_by_id(id: ID!): ContentModule!
}

This query is not currently supported

query GetContentModuleById {
  content_module_by_id(id:"some_tasklist_id") {
    __typename
    ... on PollModule {
      poll_id
    }
    ... on TaskListModule {
      tasklist_id
    }
  }
}

Expected behavior

image