Do you have a simple example of how to create a Graphql union with the types generated by Payload?
What are you trying to get exactly? It might be easier to recommend something with the full picture
So we have 3 schemas (collections), blogs, podcasts and videos, all of them shared common fields, so I want to create a union type/schema (e.g. type Post = Blog | Podcast | Video) so it can be exposed in the graphql api url and consumed by client.
You would have to make a new custom graphql endpoint
and construct a new type for yourself using the graphQL object passed via the handler withhttps://graphql.org/graphql-js/type/#graphqluniontype
something akin to
for the types you can get the generated ones from your
instance to use as types here
types: [DogType, CatType],
I wrote a guide here on how to extend the graphql APIhttps://nouance.io/articles/how-to-extend-graphql-in-payload-with-custom-queries-mutations-and-re-usable-types
Here's the guide in payload docshttps://payloadcms.com/docs/graphql/extending