Skip to content

Commit

Permalink
fix: Correct default value for JsonString
Browse files Browse the repository at this point in the history
Signed-off-by: Shanin Roman <[email protected]>
  • Loading branch information
Erigara committed Jun 5, 2024
1 parent f5e3c49 commit 7a0c14a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Binary file modified configs/swarm/executor.wasm
Binary file not shown.
11 changes: 8 additions & 3 deletions data_model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,9 +868,7 @@ mod model {
/// String containing serialized valid JSON.
///
/// This string is guaranteed to be parsed as JSON.
#[derive(
Display, Default, Debug, Clone, Encode, Decode, Ord, PartialOrd, Eq, PartialEq, IntoSchema,
)]
#[derive(Display, Debug, Clone, Encode, Decode, Ord, PartialOrd, Eq, PartialEq, IntoSchema)]
#[ffi_type(unsafe {robust})]
#[repr(transparent)]
#[display(fmt = "{}", "0")]
Expand Down Expand Up @@ -906,6 +904,13 @@ impl JsonString {
}
}

impl Default for JsonString {
fn default() -> Self {
// NOTE: empty string isn't valid JSON
Self("null".to_string())
}
}

impl From<&serde_json::Value> for JsonString {
fn from(value: &serde_json::Value) -> Self {
Self(value.to_string())
Expand Down

0 comments on commit 7a0c14a

Please sign in to comment.