-
Notifications
You must be signed in to change notification settings - Fork 162
Unable to derive from the GraphQLQuery Macro - Expected String but got &str #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, don't have a direct answer but just learned something closely related. This might help your problem. Also posting here for others to find. Likely bug with code generation for enum defaultsI was getting similar errors to those above. There is likely a code generation bug relating to enums and defaults. Issue seems to be that codegen from GQL dumps for a query's enum input defaults a string and not the newly generated native enum type. This results in errors such as yours (e.g. More precisely, the generated code for query input default (if is an enum) gets generated as e.g. Pseudo example:This fails (MyQuery.graphql)query MyQuery(
$foo: Enum1 = EnumDefault
) {
...
} This Works with graphql-clientquery MyQuery(
$foo: Enum1
) {
...
} and accessing the value in code via This is all being done with the familiar derive: #[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/schema.json",
query_path = "src/gql/MyQuery.gql",
response_derives = "Debug"
)]
pub struct MyQuery; PS, I was really struggling to find this since the solution was hidden behind another error when using graphql-client = "^0.14" |
* post start worker, and graphql-rust/graphql-client#507 (comment) * cleanup
Thanks for reporting! Definitely something to fix. |
Unable to derive from the GraphQLQuery Macro
Issue:
Error:
I tried to resolve in the following ways:
Error:
Versions:
imjacobclark@mutt:~/workspace/flow/ingestor$ rustc --version rustc 1.83.0 (90b35a623 2024-11-26)
The text was updated successfully, but these errors were encountered: