Replies: 1 comment
-
@cjvk It's not something invented by
It's not like the server could or couldn't. The GraphQL spec specifies the exact algorithm the server should follow: 1, 2, 3
I guess, no. First, the Second, even if we do that somehow, it seems to be just not right, because If you do really need operation name detection, you should use the let req: GraphQLRequest = from_whatever_source();
let document = juniper::parser::parse_document_source(document_source, &schema)?;
let operation = juniper::executor::get_operation(&req,query, req.operation_name.as_ref())?; You also need to use It seems more feasible to me, in future releases of |
Beta Was this translation helpful? Give feedback.
-
As I read the GraphQLRequest docs (and how we've implemented), the caller is expected to populate operation name (well it's optional, so "expected" isn't quite the correct word), which will then be automatically deserialized. From the perspective of a caller, isn't it somewhat odd to send the query, the input data, and also the operation name?
The server could parse the operation name from the query - and this is how our server code works, as a backup. But this seems suboptimal, since the code has to be written by all clients.
Is it possible for the Juniper library to do the parsing, and populate operation_name?
Beta Was this translation helpful? Give feedback.
All reactions