Handling Union Types with @goModel Directive #2836
islamaliev
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I'm encountering an issue with gqlgen when using the
@goModel
directive for types that are part of a union. Essentially, gqlgen fails to generate code when I bind a GraphQL type to a Go struct using@goModel
and then include that type in a union.I understand that gqlgen tries to generate an interface for the union and expects the Go structs to implement this interface. However, since I'm using
@goModel
, gqlgen can't modify the Go structs to implement the generated interface.I've considered a few workarounds, such as manually implementing the generated interface methods for my Go structs, but I'm wondering if there's a more elegant solution to this problem.
Has anyone else encountered this issue, and if so, how did you resolve it?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions