You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been running into a roadblock trying to set up a crate that re-exports graphql_client and allows users of the crate to define queries using the GraphQL macro without having to add graphql_client to their Cargo.toml. The error that occurs is: failed to resolve: could not find graphql_client in the list of imported crates.
I was able to get my crate to compile by changing this line in graphql_client_codegen from: fn build_query(variables: Self::Variables) -> ::graphql_client::QueryBody<Self::Variables> {
to fn build_query(variables: Self::Variables) -> graphql_client::QueryBody<Self::Variables> {
What is the recommendation on how to do this? Is there a way to achieve this functionality without having to change the codegen crate?
The text was updated successfully, but these errors were encountered:
As mentioned by @cameronpickham is a quick and easy fix, if the unqualified path is used then downstream crates can bring the type into scope through the middleman crate.
// in the library reexporting `graphql_client`, foo/lib.rspubuse graphql_client;// in the binary using the crate `foo`, bar/bin.rsuse foo::graphql_client;#[derive(GraphQLQuery)]structThing;
I've been running into a roadblock trying to set up a crate that re-exports
graphql_client
and allows users of the crate to define queries using theGraphQL
macro without having to addgraphql_client
to theirCargo.toml
. The error that occurs is:failed to resolve: could not find graphql_client in the list of imported crates
.I was able to get my crate to compile by changing this line in
graphql_client_codegen
from:fn build_query(variables: Self::Variables) -> ::graphql_client::QueryBody<Self::Variables> {
to
fn build_query(variables: Self::Variables) -> graphql_client::QueryBody<Self::Variables> {
What is the recommendation on how to do this? Is there a way to achieve this functionality without having to change the codegen crate?
The text was updated successfully, but these errors were encountered: