-
Notifications
You must be signed in to change notification settings - Fork 168
Description
After upgrading to 0.15.0, I’m encountering a type mismatch generated by the GraphQLQuery derive macro that appears similar to the issue previously raised in #523.
Error
error[E0308]: `?` operator has incompatible types
--> myfile.rs:8:10
|
8 | #[derive(GraphQLQuery)]
| ^^^^^^^^^^^^ expected `Option<Vec<String>>`, found `String`
|
= note: `?` operator cannot convert from `std::string::String` to `std::option::Option<Vec<std::string::String>>`
= note: expected enum `std::option::Option<Vec<std::string::String>>`
found struct `std::string::String`
= note: this error originates in the derive macro `GraphQLQuery` (in Nightly builds, run with -Z macro-backtrace for more info)
GraphQL mutation
mutation FileDelete($input: [ID!]!) {
fileDelete(fileIds: $input) {
deletedFileIds
userErrors {
field
message
}
}
}Rust macro usage:
#[derive(GraphQLQuery)]
#[graphql(
schema_path = "schema.json",
query_path = "myfile.graphql",
variables_derives = "Debug, Clone",
response_derives = "Debug, Clone",
skip_serializing_none
)]Description
The generated code seems to attempt to use the ? operator on a String where the surrounding context expects an Option<Vec<String>>. This matches the pattern described by @Sytten in #523. I also commented in there, but I figured its better with a separate issue.
I am happy to provide anything like expanded macro outputs or the schema file or whatever can help debug this.
Expected behavior
The derive macro should generate code that correctly matches the schema types (in this case: a non-null list of non-null IDs). Earlier versions did not produce this mismatch. This is the only issue I have had after atempting to upgrade to 0.15.0.