Skip to content

Are subscriptions limited to being top level? #908

Open
@jerel

Description

@jerel

I think this is a bug but I'm not sure... I've spent several days reading code and trying in vain to achieve this so I'd like a second opinion.

Queries can be set up like this (and so can mutations):

pub struct QueryRoot;

#[juniper::graphql_object(Context = Context)]
impl QueryRoot {
  fn settings(&self) -> settings::SettingQueries {
    settings::SettingQueries
  }
  fn other(&self) -> other::OtherQueries {
    other::OtherQueries
  }
}

However, no variation of this seems to be possible with Subscriptions (this doesn't compile):

pub struct SubscriptionRoot;

#[juniper::graphql_subscription(Context = Context)]
impl SubscriptionRoot {
  fn settings(&self) -> settings::SettingSubscriptions {
    settings::SettingSubscriptions
  }
  fn other(&self) -> other::OtherSubscriptions {
    other::OtherSubscriptions
  }
}

Shouldn't this work or is it a design decision? Are all subscriptions for the whole app required to be in one root impl?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions