Open ta32 opened 2 years ago
Hi @ta32, thanks for reporting this! I think this can be fixed without touching any macro code. My first instinct would be to look here: https://github.com/graphql-rust/graphql-client/blob/fd5dc3dc7223616e1f5a3b35df4b39e8f80e6412/graphql_client_codegen/src/codegen.rs#L96 — it should also be pretty easy to write a test (with a minimal schema, to check that it doesn't compile before the fix, then that it does after the fix and that the default is what you would expect). If you want to pick this up, I'm happy to review a PR — I can't guarantee when it's going to be fixed otherwise, since there is very little free time to work on this project.
sure I can have a go a fixing this issue
Hello, any update?
I created a failing test, but I wanted to simplify it a bit to make it easier to debug the code and understand this. There is a manual work around for this issue - use the code gen mode and fix the generated code to get it to compile.
Any further updates on this? (Still need to apply the manual workaround when using the cli)
Hi I am working on another project at the moment - my knowledge of rust macro's isn't that great so probably not going to pick up this issue any time soon
No updates as long as nobody picks this up. Nobody is paid to work on this crate, but several people have merge and release permissions.
When this issue was happening I was using the derive macro, however the compile error was very strange. Warning about taking a str. I switch to the code gen method to see what was happening.
The query has variables where one is typed as an enum
The generated variable section is:
I manually corrected it too
Then the query works, I suspect the same issue was occurring with the macro derive method. Good thing we have this code gen tool because it would be much harder to troubleshoot the proc macro :)
would this be a simple fix for a beginner, I don't have much knowledge about proc macros though