Closed
Description
I tried asking this question on the actual PR #431 that was meant to solve this issue, but got no response, so I'm just gonna move the question into this issue.
I've added skip_serializing_none
to the struct as stated in the README, but doing so still leaves me with null
values after serialization.
My first guess was that this hasn't been released yet, so I switch over to the main
branch in Cargo.toml
, but that changed nothing. Here's the code I'm using:
#[derive(GraphQLQuery)]
#[graphql(
schema_path = "graphql/schema.graphql",
query_path = "graphql/insert_mutation.graphql",
response_derives = "Debug",
skip_serializing_none
)]
pub struct InsertMutation;
let vars = Variables {
// .. omitted
user_id: None,
// .. omitted
};
let q = crate::graphql::InsertMutation::build_query(vars);
let skipped = serde_json::to_string_pretty(&q).unwrap();
println!("{skipped}");
Output:
{
"variables": {
// .. omitted
"user_id": null,
// .. omitted
},
...
}
Is there something obvious I'm missing here to make this work, or is this something that warrants it's own issue?