From c83593268674072dda3c9065b6cc3a8d782ea00b Mon Sep 17 00:00:00 2001 From: Raimundo Henriques Date: Tue, 12 Dec 2023 12:40:01 +0000 Subject: [PATCH] fix: allow null geographicScope and update sample_data --- endpoint/src/datamodel.rs | 4 ++-- endpoint/src/sample_data.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/endpoint/src/datamodel.rs b/endpoint/src/datamodel.rs index 9f6b353..f33e4be 100644 --- a/endpoint/src/datamodel.rs +++ b/endpoint/src/datamodel.rs @@ -52,7 +52,8 @@ pub struct CarbonFootprint { pub declared_unit: DeclaredUnit, pub unitary_product_amount: StrictlyPositiveDecimal, pub p_cf_excluding_biogenic: PositiveDecimal, - pub p_cf_including_biogenic: WrappedDecimal, + #[serde(skip_serializing_if = "Option::is_none")] + pub p_cf_including_biogenic: Option, pub fossil_ghg_emissions: PositiveDecimal, pub fossil_carbon_content: PositiveDecimal, pub biogenic_carbon_content: PositiveDecimal, @@ -86,7 +87,6 @@ pub struct CarbonFootprint { pub reference_period_start: DateTime, pub reference_period_end: DateTime, - #[serde(flatten)] #[serde(skip_serializing_if = "Option::is_none")] pub geographic_scope: Option, diff --git a/endpoint/src/sample_data.rs b/endpoint/src/sample_data.rs index bbff189..1ebf5eb 100644 --- a/endpoint/src/sample_data.rs +++ b/endpoint/src/sample_data.rs @@ -56,7 +56,7 @@ lazy_static! { packaging_emissions_included: false, packaging_ghg_emissions: None, p_cf_excluding_biogenic: dec!(0.0).into(), - p_cf_including_biogenic: dec!(0.0).into(), + p_cf_including_biogenic: Some(dec!(0.0).into()), uncertainty_assessment_description: None, }; }