omit empty error vec in data message serialization (#732)

This commit is contained in:
Chris 2020-08-02 03:43:10 -04:00 committed by GitHub
parent db209b38c4
commit 6788ef20c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,7 @@ pub struct DataPayload<S> {
/// The errors that have occurred during execution. Note that parse and validation errors are
/// not included here. They are sent via Error messages.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub errors: Vec<ExecutionError<S>>,
}
@ -163,7 +164,7 @@ mod test {
},
})
.unwrap(),
r##"{"type":"data","id":"foo","payload":{"data":null,"errors":[]}}"##,
r##"{"type":"data","id":"foo","payload":{"data":null}}"##,
);
assert_eq!(