C
C#2y ago
zCore

❔ Strawberry Shake Prevent Null Serialization (JSON)

1. Write a mutation with optional parameters, which map to optional parameters.
mutation Foo(bar: Int, baz: Int) {
theThing(bar: $bar, baz: $baz {
id
# etc...
}
}
mutation Foo(bar: Int, baz: Int) {
theThing(bar: $bar, baz: $baz {
id
# etc...
}
}
2. Call the muation with null on one parameter
johnDoeClient.Foo.ExecuteAsync(3, null);
johnDoeClient.Foo.ExecuteAsync(3, null);
3. The resulting json for the parameters will be
{
"bar": 3,
"baz": null
}
{
"bar": 3,
"baz": null
}
Now in my case the server actually expects this value to be not null and null is representing optional in this case. Leading the null being serialized to an exception comming from the server complaining. Is there any way to tell Strawberry Shake to not serialize null?
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server