-
-
Notifications
You must be signed in to change notification settings - Fork 786
Open
Labels
Description
Product
Hot Chocolate
Version
15.1.7
Link to minimal reproduction
https://github.com/wdkr/HotChocolateDemo
Steps to reproduce
I can organize my queries by grouping them into nested classes. For example:
public class Query
{
public LibraryQueries Library() => new();
public class LibraryQueries
{
public Book GetBook()
{
return new Book { Title = "C# in depth", Author = "Jon Skeet" };
}
}
}
I can then run the following query:
query {
library {
book {
title
author
}
}
}
This works fine. If I try to do the same with subscriptions:
public class Subscription
{
public LibrarySubscriptions Library() => new();
public class LibrarySubscriptions
{
[Subscribe]
[Topic("BookAdded")]
public Book BookAdded([EventMessage] Book book) => book;
}
}
And try to subscribe to the bookAdded
event:
subscription {
library {
bookAdded {
title
author
}
}
}
I get the following websocket error:
You must declare a subscribe resolver for subscription fields.
Is this supposed to work or unsupported?
What is expected?
Being able to subscribe to subscriptions defined in nested classes.
What is actually happening?
The websocket connection fails and the error message "You must declare a subscribe resolver for subscription fields." is shown in the message log.
Relevant log output
Additional context
No response