smallrye / smallrye-graphql

Implementation for MicroProfile GraphQL
Apache License 2.0
155 stars 89 forks source link

Unable to generate Federation schema with no @Query functions #2110

Open nicholassmith opened 2 months ago

nicholassmith commented 2 months ago

Maybe this is a bit edge case but it's valid for federation and I can't quite figure out how to achieve it. I would like to generate a schema like:

union _Entity = Shelf

type Books {
   name: String!
   shelf: Shelf
....

"Query root"
type Query {
   _entities(representations: [_Any!]!): [_Entity]!
   _service: _Service!
}

...

However with smallrye-graphql I need at least 1 query for it to build the schema and then invoke the Federation transformer to add the additional entities query that allows for this usecase. The only thing I can think of is that when it checks schema.hasOperations()) in Bootstrap.java it should also check to see if it will generate the entities query.