From 3dd327172a68656012f2eda71b8885c69f62f6aa Mon Sep 17 00:00:00 2001 From: Anton Oehler Date: Fri, 6 Dec 2024 15:12:32 +0100 Subject: [PATCH] fix: skip None instead of outputting empty elements --- src/components/structs.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/structs.rs b/src/components/structs.rs index cb4e4c5..f0a6b02 100644 --- a/src/components/structs.rs +++ b/src/components/structs.rs @@ -434,15 +434,15 @@ pub struct ApplicableHeaderTradeSettlement <'invoice>{ #[derive(Serialize, Clone, Copy, Debug)] pub struct ApplicableTradeTax <'invoice> { - #[serde(rename="ram:CalculatedAmount",serialize_with="format_f64_option")] + #[serde(rename="ram:CalculatedAmount",serialize_with="format_f64_option", skip_serializing_if = "Option::is_none")] pub calculated_amount: Option, #[serde(rename="ram:TypeCode")] pub type_code: &'invoice str, - #[serde(rename="ram:BasisAmount",serialize_with="format_f64_option")] + #[serde(rename="ram:BasisAmount",serialize_with="format_f64_option", skip_serializing_if = "Option::is_none")] pub basis_amount: Option, #[serde(rename="ram:CategoryCode")] pub category_code: VATCategoryCode, - #[serde(rename="ram:RateApplicablePercent",serialize_with="format_f64_option")] + #[serde(rename="ram:RateApplicablePercent",serialize_with="format_f64_option", skip_serializing_if = "Option::is_none")] pub rate_applicable_percent: Option, } @@ -485,7 +485,7 @@ pub struct SpecifiedTradeSettlementHeaderMonetarySummation { #[serde(rename="ram:TaxBasisTotalAmount",serialize_with="format_f64_option")] pub tax_basis_total_amount: Option, /// `BT-110`: The total VAT amount for the Invoice. - #[serde(rename="ram:TaxTotalAmount")] + #[serde(rename="ram:TaxTotalAmount", skip_serializing_if = "Option::is_none")] pub tax_total_amount: Option, /// `BT-112`: The total amount of the Invoice with VAT. #[serde(rename="ram:GrandTotalAmount",serialize_with="format_f64_option")]