Skip to content

Commit

Permalink
feat: add extra null case handlings for realtime messages
Browse files Browse the repository at this point in the history
  • Loading branch information
roberts-pumpurs committed Jan 4, 2025
1 parent 8e4f223 commit 4855d66
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/supabase-realtime/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ pub struct ProtocolMessage {
#[serde(flatten)]
pub payload: ProtocolPayload,
#[serde(rename = "ref")]
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_field: Option<String>,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub join_ref: Option<String>,
}

Expand Down Expand Up @@ -83,6 +87,8 @@ pub mod phx_reply {
pub event: PostgresChangetEvent,
pub schema: String,
pub table: String,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub filter: Option<String>,
pub id: i32,
}
Expand Down Expand Up @@ -275,6 +281,8 @@ pub mod phx_join {
#[serde(rename = "config")]
pub config: JoinConfig,
#[serde(rename = "access_token")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub access_token: Option<String>,
}

Expand Down Expand Up @@ -306,6 +314,8 @@ pub mod phx_join {
pub event: PostgresChangetEvent,
pub schema: String,
pub table: String,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub filter: Option<String>,
}

Expand Down Expand Up @@ -984,6 +994,7 @@ pub mod postgres_changes {
#[serde(rename = "commit_timestamp")]
pub commit_timestamp: String,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub errors: Option<String>,
#[serde(default, rename = "old_record")]
pub old_record: Option<O>,
Expand Down

0 comments on commit 4855d66

Please sign in to comment.