From 483acc44cc41b814ea052302bea359c0b250aa02 Mon Sep 17 00:00:00 2001 From: Benedikt Schneppe Date: Fri, 17 Jan 2025 19:24:46 +0100 Subject: [PATCH] chore: create fork of yaserde to release to crates.io (#2) --- Cargo.lock | 54 ++++++++++++++++++++------------------ Cargo.toml | 4 +-- src/cii/cii_model.rs | 2 +- src/lib.rs | 12 ++++----- src/ubl/ubl_model.rs | 18 ++++++------- tests/test_suite_runner.rs | 4 +-- 6 files changed, 48 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d051e5..18ae013 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -440,6 +440,8 @@ name = "einvoice" version = "0.1.0" dependencies = [ "chrono", + "einvoice_deps_yaserde", + "einvoice_deps_yaserde_derive", "lopdf", "rayon", "regex", @@ -448,8 +450,32 @@ dependencies = [ "thiserror 2.0.11", "uniffi", "xmltree", - "yaserde", - "yaserde_derive", +] + +[[package]] +name = "einvoice_deps_yaserde" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86694472f7474822a326d0da348f4e04afb3bf2174d156999b2ad99cd8e36fe5" +dependencies = [ + "log", + "xml-rs", +] + +[[package]] +name = "einvoice_deps_yaserde_derive" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0eef462f0fe1a89e6e721773d85fb06f9d7078cfbfb08895974030b6726612d" +dependencies = [ + "heck", + "log", + "proc-macro2", + "quote", + "serde", + "serde_tokenstream", + "syn 2.0.91", + "xml-rs", ] [[package]] @@ -1665,30 +1691,6 @@ dependencies = [ "xml-rs", ] -[[package]] -name = "yaserde" -version = "0.12.0" -source = "git+https://github.com/BSchneppe/yaserde.git?branch=feat%2Fnested#f1a52f218a1b7e93d8c53386e67d42b46548fa00" -dependencies = [ - "log", - "xml-rs", -] - -[[package]] -name = "yaserde_derive" -version = "0.12.0" -source = "git+https://github.com/BSchneppe/yaserde.git?branch=feat%2Fnested#f1a52f218a1b7e93d8c53386e67d42b46548fa00" -dependencies = [ - "heck", - "log", - "proc-macro2", - "quote", - "serde", - "serde_tokenstream", - "syn 2.0.91", - "xml-rs", -] - [[package]] name = "zerocopy" version = "0.7.35" diff --git a/Cargo.toml b/Cargo.toml index 413f218..2411ff4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -yaserde = { git = "https://github.com/BSchneppe/yaserde.git" , branch = "feat/nested"} -yaserde_derive ={ git = "https://github.com/BSchneppe/yaserde.git" , branch = "feat/nested"} +einvoice_deps_yaserde = { version = "0.0.1"} +einvoice_deps_yaserde_derive ={ version = "0.0.1"} thiserror = "2.0.11" rayon = "1.10.0" uniffi = { version = "0.28.3", features = ["cli"] } diff --git a/src/cii/cii_model.rs b/src/cii/cii_model.rs index debefd4..55046e0 100644 --- a/src/cii/cii_model.rs +++ b/src/cii/cii_model.rs @@ -1,4 +1,4 @@ -use yaserde_derive::{YaDeserialize, YaSerialize}; +use einvoice_deps_yaserde_derive::{YaDeserialize, YaSerialize}; #[derive(YaSerialize, YaDeserialize, uniffi::Record)] #[yaserde( default_namespace = "", diff --git a/src/lib.rs b/src/lib.rs index d34628c..92c9d54 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,11 @@ use crate::cii::cii_business_rule_validator; use crate::ubl::ubl_business_rule_validator; use crate::ZugferdProfile::EN16931; pub use cii::cii_model::CrossIndustryInvoice; +use einvoice_deps_yaserde::__xml::attribute::OwnedAttribute; +use einvoice_deps_yaserde::__xml::namespace::Namespace; +use einvoice_deps_yaserde::de::Deserializer; +use einvoice_deps_yaserde::ser::Serializer; +use einvoice_deps_yaserde::{YaDeserialize, YaSerialize}; use lopdf::Document; use lopdf::Error; use lopdf::Object; @@ -20,11 +25,6 @@ use std::io::{Read, Write}; use std::sync::Arc; use thiserror::Error; pub use ubl::ubl_model::UblInvoice; -use yaserde::__xml::attribute::OwnedAttribute; -use yaserde::__xml::namespace::Namespace; -use yaserde::de::Deserializer; -use yaserde::ser::Serializer; -use yaserde::{YaDeserialize, YaSerialize}; uniffi::setup_scaffolding!(); #[derive(Debug, uniffi::Error, Error)] @@ -104,7 +104,7 @@ impl YaSerialize for InvoiceStandard { #[uniffi::export] pub fn validate_invoice(xml: &str) -> Result { let invoice_standard: InvoiceStandard = - yaserde::de::from_str(xml).map_err(InvoiceError::ParseError)?; + einvoice_deps_yaserde::de::from_str(xml).map_err(InvoiceError::ParseError)?; match &invoice_standard { InvoiceStandard::UBL(invoice) => { diff --git a/src/ubl/ubl_model.rs b/src/ubl/ubl_model.rs index ae00ba3..ebfa6ea 100644 --- a/src/ubl/ubl_model.rs +++ b/src/ubl/ubl_model.rs @@ -1,19 +1,19 @@ use crate::UniffiCustomTypeConverter; use chrono::{DateTime, NaiveDate, NaiveTime, TimeZone, Utc}; +use einvoice_deps_yaserde::__xml::attribute::OwnedAttribute; +use einvoice_deps_yaserde::__xml::name::OwnedName; +use einvoice_deps_yaserde::__xml::namespace::Namespace; +use einvoice_deps_yaserde::__xml::reader::XmlEvent as ReaderXmlEvent; +use einvoice_deps_yaserde::__xml::writer::XmlEvent; +use einvoice_deps_yaserde::de::Deserializer; +use einvoice_deps_yaserde::ser::Serializer; +use einvoice_deps_yaserde::{YaDeserialize, YaSerialize}; +use einvoice_deps_yaserde_derive::{YaDeserialize, YaSerialize}; use rust_decimal::prelude::ToPrimitive; use rust_decimal::Decimal; use std::io::Read; use std::str::FromStr; use std::time::SystemTime; -use yaserde::__xml::attribute::OwnedAttribute; -use yaserde::__xml::name::OwnedName; -use yaserde::__xml::namespace::Namespace; -use yaserde::__xml::reader::XmlEvent as ReaderXmlEvent; -use yaserde::__xml::writer::XmlEvent; -use yaserde::de::Deserializer; -use yaserde::ser::Serializer; -use yaserde::{YaDeserialize, YaSerialize}; -use yaserde_derive::{YaDeserialize, YaSerialize}; #[derive(Debug)] pub struct Iso8601Date(NaiveDate); diff --git a/tests/test_suite_runner.rs b/tests/test_suite_runner.rs index cd24faa..9d95773 100644 --- a/tests/test_suite_runner.rs +++ b/tests/test_suite_runner.rs @@ -17,7 +17,7 @@ mod tests { let invoice = validate_invoice(&original).unwrap(); // Serialize - let serialized = yaserde::ser::to_string(&invoice).unwrap(); + let serialized = einvoice_deps_yaserde::ser::to_string(&invoice).unwrap(); // Normalize both strings let normalized_original = normalize_xml(&original); @@ -38,7 +38,7 @@ mod tests { let invoice = validate_invoice(&original).unwrap(); // Serialize - let serialized = yaserde::ser::to_string(&invoice).unwrap(); + let serialized = einvoice_deps_yaserde::ser::to_string(&invoice).unwrap(); // Normalize both strings let normalized_original = normalize_xml(&original);