-
Notifications
You must be signed in to change notification settings - Fork 159
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
Dependencies to query file and schema file are not tracked by the compiler when deriving GraphQLQuery
#215
Comments
Haha @upsuper I just wanted to create an issue for this, also suggesting the pest workaround. ( I remember the pest docs instructing you to add the include_str! manually in the past). |
Thanks for the trick! We should definitely do this. There could be a compile time impact with huge schemas, but let's see. |
One potential issue is that we work with file paths relative to the Cargo.toml, but include_str! works with paths relative to the current file, I think, so we need to map them somehow. |
You can just use an absolute path. |
This will force the regenaration the generated modules when query files change. See issue 215: #215 Also extract GraphQLClientCodegenOptions to its own module, and use accessors instead of a raw data struct.
PR #223 addresses this - it doesn't include the schema however, as I'm afraid of the performance impact of including a large schema in all generated modules. It may be irrational though. |
This will force the regenaration the generated modules when query files change. See issue 215: #215 Also extract GraphQLClientCodegenOptions to its own module, and use accessors instead of a raw data struct.
This will force the regenaration the generated modules when query files change. See issue 215: #215 Also extract GraphQLClientCodegenOptions to its own module, and use accessors instead of a raw data struct.
This will force the regenaration the generated modules when query files change. See issue 215: #215 Also extract GraphQLClientCodegenOptions to its own module, and use accessors instead of a raw data struct.
This will force the regenaration the generated modules when query files change. See issue 215: #215 Also extract GraphQLClientCodegenOptions to its own module, and use accessors instead of a raw data struct.
This will force the regenaration the generated modules when query files change. See issue 215: #215 Also extract GraphQLClientCodegenOptions to its own module, and use accessors instead of a raw data struct.
This was just released as part of 0.7.0. Let's see if including the schema file in generated code will turn out to be necessary as well. |
See also #117 which resolved to just mention this limitation in the readme. |
Thanks for the heads up, we should mention this in the README indeed. edit: I misinterpreted your message apparently, sorry. Anyway, we should track the cargo-based solution because I feel uneasy about the situation with schema files, as mentioned in this thread. |
When using
#[derive(GraphQLQuery)]
, after compiling, if you change the query file or the schema file and runcargo build
again, it would do nothing.This is because compiler is unaware of the change to the file.
To fix this, the macro should insert
include_str!
orinclude_bytes!
into the generated code, so that compiler can be aware of such build dependency.See pest-parser/pest#272 as an example of this trick.
The text was updated successfully, but these errors were encountered: