Remove serde serialization field skipping

Due to a bug in msgpack-rust (https://github.com/3Hren/msgpack-rust/issues/86), in order to have correct serialization<->deserialization of data, we need to ensure all fields are serialized even when empty. This will affect the output size of the data, but will ensure that once serialized, the data is deserialized without issue.
This commit is contained in:
Tobie Morgan Hitchcock 2022-02-23 11:18:46 +00:00
parent 19909885e9
commit 7710451d7b
13 changed files with 0 additions and 47 deletions

View file

@ -38,9 +38,7 @@ impl fmt::Display for Dir {
pub struct Graph {
pub dir: Dir,
pub what: Tables,
#[serde(skip_serializing_if = "Option::is_none")]
pub cond: Option<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub alias: Option<Idiom>,
}

View file

@ -11,9 +11,7 @@ use std::fmt;
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct Model {
pub table: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub range: Option<(u64, u64)>,
}

View file

@ -20,11 +20,8 @@ use std::fmt;
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct CreateStatement {
pub what: Values,
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<Data>,
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<Output>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout: Option<Timeout>,
}

View file

@ -186,9 +186,7 @@ fn database(i: &str) -> IResult<&str, DefineDatabaseStatement> {
pub struct DefineLoginStatement {
pub name: String,
pub base: Base,
#[serde(skip_serializing_if = "Option::is_none")]
pub pass: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub hash: Option<String>,
}
@ -355,13 +353,9 @@ fn token(i: &str) -> IResult<&str, DefineTokenStatement> {
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct DefineScopeStatement {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<Duration>,
#[serde(skip_serializing_if = "Option::is_none")]
pub signup: Option<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub signin: Option<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub connect: Option<Value>,
}
@ -483,7 +477,6 @@ pub struct DefineTableStatement {
pub name: String,
pub drop: bool,
pub full: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub view: Option<View>,
pub permissions: Permissions,
}
@ -682,13 +675,9 @@ fn event(i: &str) -> IResult<&str, DefineEventStatement> {
pub struct DefineFieldStatement {
pub name: Idiom,
pub what: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<Kind>,
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub assert: Option<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub priority: Option<u64>,
pub permissions: Permissions,
}

View file

@ -21,11 +21,8 @@ use std::fmt;
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct DeleteStatement {
pub what: Values,
#[serde(skip_serializing_if = "Option::is_none")]
pub cond: Option<Cond>,
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<Output>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout: Option<Timeout>,
}

View file

@ -14,7 +14,6 @@ use std::fmt;
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct IfelseStatement {
pub exprs: Vec<(Value, Value)>,
#[serde(skip_serializing_if = "Option::is_none")]
pub close: Option<Value>,
}

View file

@ -24,11 +24,8 @@ pub struct InsertStatement {
pub into: Table,
pub data: Data,
pub ignore: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub update: Option<Data>,
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<Output>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout: Option<Timeout>,
}

View file

@ -19,9 +19,7 @@ use std::fmt;
pub struct LiveStatement {
pub expr: Fields,
pub what: Values,
#[serde(skip_serializing_if = "Option::is_none")]
pub cond: Option<Cond>,
#[serde(skip_serializing_if = "Option::is_none")]
pub fetch: Option<Fetchs>,
}

View file

@ -27,11 +27,8 @@ pub struct RelateStatement {
pub from: Values,
pub with: Values,
pub uniq: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<Data>,
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<Output>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout: Option<Timeout>,
}

View file

@ -28,23 +28,14 @@ use std::fmt;
pub struct SelectStatement {
pub expr: Fields,
pub what: Values,
#[serde(skip_serializing_if = "Option::is_none")]
pub cond: Option<Cond>,
#[serde(skip_serializing_if = "Option::is_none")]
pub split: Option<Splits>,
#[serde(skip_serializing_if = "Option::is_none")]
pub group: Option<Groups>,
#[serde(skip_serializing_if = "Option::is_none")]
pub order: Option<Orders>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<Limit>,
#[serde(skip_serializing_if = "Option::is_none")]
pub start: Option<Start>,
#[serde(skip_serializing_if = "Option::is_none")]
pub fetch: Option<Fetchs>,
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<Version>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout: Option<Timeout>,
}

View file

@ -21,13 +21,9 @@ use std::fmt;
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct UpdateStatement {
pub what: Values,
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<Data>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cond: Option<Cond>,
#[serde(skip_serializing_if = "Option::is_none")]
pub output: Option<Output>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timeout: Option<Timeout>,
}

View file

@ -8,9 +8,7 @@ use std::fmt;
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct UseStatement {
#[serde(skip_serializing_if = "Option::is_none")]
pub ns: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub db: Option<String>,
}

View file

@ -14,9 +14,7 @@ use std::fmt;
pub struct View {
pub expr: Fields,
pub what: Tables,
#[serde(skip_serializing_if = "Option::is_none")]
pub cond: Option<Cond>,
#[serde(skip_serializing_if = "Option::is_none")]
pub group: Option<Groups>,
}