ctison/graphql-codegen-golang

Support for union types

ecker00 opened this issue · 2 comments

First thank you for making this, great tool to get GoLang clients up to speed fast.

I noticed that union types are ignored when generating:

union AorB = A | B

In the output AorB does not exist, and other types which use it comes up as undefined like this:

type Results struct {
	Hits  *[]undefined `json:"hits,omitempty"`
	Total Int          `json:"total"`
}

I'd also love this, if it's possible. I'm completely unfamiliar with Go-lang so I'm not sure if it even supports union types.
For my use case, omitting union types in generated .go file would solve my immediate problem so I created this branch.

@ctison if I open a PR for it, would you accept it?

Yes, please do. @zigomir