Open ehiggs opened 2 years ago
I'll leave this here as I also struggled with this...
Schema files are interchangeable, using a .json
in place of a .graphql
is perfectly fine and vice versa.
Both
#[derive(GraphQLQuery)]
#[graphql(
schema_path = "tests/unions/union_schema.graphql",
query_path = "tests/unions/union_query.graphql",
)]
pub struct UnionQuery;
and
#[derive(GraphQLQuery)]
#[graphql(
schema_path = "tests/unions/union_schema.json",
query_path = "tests/unions/union_query.graphql",
)]
pub struct UnionQuery;
should work.
The README says the following:
The first command will create a json. "We now have everything we need to derive Rust types for our query". But then the code points to some graphql schema that we do not have. Trying various things with the graphql-client tool I can't see how to distill a graphql schema. Instead I've been using gql-cli from python to work around this.
If this is all possible in graphql-client, it should be documented here. Else, it would be a good feature so the docs work as written. :)