nits: use generic deserializer for empty data (#5727)

* use generic deserializer for empty data

* update repo ref

* fix import
This commit is contained in:
dieriba
2025-05-12 11:00:55 +02:00
committed by GitHub
parent eca587ddf4
commit 00faf1eefe
7 changed files with 38 additions and 23 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ use {
axum::extract::Request,
http::HeaderMap,
serde::de::DeserializeOwned,
windmill_common::{error::Error, utils::empty_string_as_none},
windmill_common::{error::Error, utils::empty_as_none},
};
#[cfg(all(feature = "enterprise", feature = "kafka"))]
@@ -162,9 +162,9 @@ pub struct SqsTriggerConfig {
pub struct GcpTriggerConfig {
pub gcp_resource_path: String,
pub subscription_mode: SubscriptionMode,
#[serde(default, deserialize_with = "empty_string_as_none")]
#[serde(default, deserialize_with = "empty_as_none")]
pub subscription_id: Option<String>,
#[serde(default, deserialize_with = "empty_string_as_none")]
#[serde(default, deserialize_with = "empty_as_none")]
pub base_endpoint: Option<String>,
#[serde(flatten)]
pub create_update: Option<CreateUpdateConfig>,
+4 -4
View File
@@ -11,7 +11,7 @@ use windmill_common::db::UserDB;
use windmill_common::worker::to_raw_value;
use windmill_common::{
error::{Error as WindmillError, Result as WindmillResult},
utils::empty_string_as_none,
utils::empty_as_none,
};
use windmill_queue::TriggerKind;
@@ -33,9 +33,9 @@ impl Default for DeliveryType {
#[derive(FromRow, Deserialize, Serialize, Debug)]
#[allow(unused)]
pub struct PushConfig {
#[serde(deserialize_with = "empty_string_as_none")]
#[serde(deserialize_with = "empty_as_none")]
route_path: Option<String>,
#[serde(deserialize_with = "empty_string_as_none")]
#[serde(deserialize_with = "empty_as_none")]
audience: Option<String>,
authenticate: bool,
base_endpoint: String,
@@ -44,7 +44,7 @@ pub struct PushConfig {
#[allow(unused)]
pub struct CreateUpdateConfig {
pub delivery_type: DeliveryType,
#[serde(default, deserialize_with = "empty_string_as_none")]
#[serde(default, deserialize_with = "empty_as_none")]
pub subscription_id: Option<String>,
pub delivery_config: Option<SqlxJson<PushConfig>>,
}