Open
Description
With current APIs it is possible to have mismatch between the struct, Variables
and ResponseData
. Example from the README.md:
let request_body = UnionQuery::build_query(variables);
let client = reqwest::Client::new();
let mut res = client.post("/graphql").json(&request_body).send()?;
let response_body: Response<union_query::ResponseData> = res.json()?;
The cast in the last line can be replaced with any other ResponseData
without a compilation error.
I would like to know if there is interest in fixing the issue. I've prototyped a simple trait that solves the issue for me:
let response_body = UnionQuery::execute(variables, &client)?;
The client
is actually a trait so it is not coupled with reqwest
. I will add a PR with draft of the proposed API.
Metadata
Metadata
Assignees
Labels
No labels