I wanted to create a union named Tables, that holds all the other tables and the user can request the table accordingly.
I get the error:
You have asked for named object type ‘Tables’, but it’s not an object type but rather a ‘graphql.schema.GraohQLUnionType’
Here is my graphql schema:
type Query{
getData: [Tables]
}
union Tables = Address | Identifier
My query is a simple one:
query allData{
getData{
__typename
}
}
My Java method looks like this:
@QueryMapping
Public List getData() {
return List.of{ new Address() }; }
I saw some implementations and this should work, but throws an error in my case.
I simply wanted to create a generic controller that can serve as an entry point for all the tables.
I thought union would do the job, what can I do in this case?