Skip to content

Commit

Permalink
Merge pull request #15 from AntonHermann/fix-skip-serializing-if-none
Browse files Browse the repository at this point in the history
fix: skip None instead of outputting empty elements
  • Loading branch information
FaultierSP authored Dec 19, 2024
2 parents dc22e4b + 3dd3271 commit edd6399
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<f64>,
#[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<f64>,
#[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<f64>,

}
Expand Down Expand Up @@ -485,7 +485,7 @@ pub struct SpecifiedTradeSettlementHeaderMonetarySummation {
#[serde(rename="ram:TaxBasisTotalAmount",serialize_with="format_f64_option")]
pub tax_basis_total_amount: Option<f64>,
/// `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<TaxTotalAmount>,
/// `BT-112`: The total amount of the Invoice with VAT.
#[serde(rename="ram:GrandTotalAmount",serialize_with="format_f64_option")]
Expand Down

0 comments on commit edd6399

Please sign in to comment.