#✅ - Use of union in GraphQL

5 messages · Page 1 of 1 (latest)

hearty hound
#

I'm trying to use a union in my GraphQL schema, however the codegen just outputs errors. Is it a bug or does Amplify not support it?

union EventUnion = Concert | Festival | Conference

type debuggingCodegen @model {
    id: ID!
    events: [Conference] ## <-- Works
    eventUn: [EventUnion] ## <-- Does NOT work
}

Error:

Unknown type "EventUnionInput". Did you mean "EventUnion", "LocationInput", "VenueInput", or "PersonInput"?
#

I tried to manually create interface EventUnionInput, but that just causes more issues with codgen (it expects the input instead of the type).

Error: Unknown type EventUnion for field eventUn. Did you forget to add the @model directive

kind flower
hearty hound
#

Thanks to the reply! Will work around it for now - hopefully it will be supported later 😄

lyric boughBOT
#

✅ - Use of union in GraphQL