graphql-client
graphql-client copied to clipboard
proc-macro derive panicked #[derive(GraphQLQuery)]
#[derive(GraphQLQuery)]
| ^^^^^^^^^^^^
|
= help: message: unnamed operation
Project fails to compile with the error above.
here are my imports:
use graphql_client::*;
use wasm_bindgen::prelude::*;
use web_sys::console;
#[derive(GraphQLQuery)]
#[graphql(
query_path = "backend/users.graphql",
schema_path = "backend/schema.json",
response_derives = "Debug",
deprecated = "warn"
)]
pub struct Users;
users.graphql:
query {
users {
id
email
}
}
We should improve the error message, but the fix is to name the operation. For example:
query TheQuery {
users {
id
email
}
}
I'm getting the same error even though my struct name is same as query, Transactions. The files queries.graphql and schema.json seem to be found. Line #[derive(GraphQLQuery)] is where the error occurs.
`use graphql_client::*;
#[derive(GraphQLQuery)]
#[graphql(
query_path = "src/common/gql/queries.graphql",
schema_path = "src/common/gql/schema.json"
)]
pub struct Transactions {}
query Transactions($ids: [ID!]) {
transactions(ids: $ids) {
edges {
node {
id
signature
}
}
}
}
`