Currently there's no way to know if a request contains a subscription operation until you try to execute it. This is a problem for example in our graphql-ws implementation, which currently just has to invoke both juniper::execute and juniper::resolve_into_stream and see what works:
|
// TODO: This could be made more efficient if juniper exposed functionality to allow us to |
|
// parse and validate the query, determine whether it's a subscription, and then execute |
|
// it. For now, the query gets parsed and validated twice. |
It would be useful if juniper had a lower level API that could be used to parse and validate a query, determine what type of operation is requested, then execute it.
Currently there's no way to know if a request contains a subscription operation until you try to execute it. This is a problem for example in our graphql-ws implementation, which currently just has to invoke both
juniper::executeandjuniper::resolve_into_streamand see what works:juniper/juniper_graphql_ws/src/lib.rs
Lines 301 to 303 in 84c9720
It would be useful if
juniperhad a lower level API that could be used to parse and validate a query, determine what type of operation is requested, then execute it.