Skip to content

"EmptyQueryTypeException: Invalid query object type" when only exposing a subscription #830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
itsandreramon opened this issue Aug 5, 2020 · 1 comment
Labels
type: bug Something isn't working

Comments

@itsandreramon
Copy link

Library Version
3.6.1

Describe the bug
Cannot create a Spring Boot server using only a single subscription. I need to provide also a query. Spring Boot crashes with the following exception:

com.expediagroup.graphql.exceptions.EmptyQueryTypeException: Invalid query object type - no valid queries are available

To Reproduce

@Component
class BookSubscription(
  private val bookService: BookService
) : Subscription {

  @GraphQLDescription("Returns a single book in a non-blocking way")
  fun findBookById(id: Int): Mono<Book> {
    return bookService.findBookById(id)
  }
}

Expected behavior
Should generate a schema that consists only of one subscription type like this:

schema {
  subscription: Subscription
}
@itsandreramon itsandreramon added the type: bug Something isn't working label Aug 5, 2020
@dariuszkuc
Copy link
Collaborator

Root query type is required as per GraphQL Spec.

See graphql/graphql-spec#631 for additional details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Development

No branches or pull requests

2 participants