mirror of
https://github.com/BSchneppe/einvoice-rs.git
synced 2026-03-17 10:24:08 +00:00
chore: create fork of yaserde to release to crates.io (#2)
This commit is contained in:
committed by
GitHub
parent
4006542d4e
commit
483acc44cc
54
Cargo.lock
generated
54
Cargo.lock
generated
@@ -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"
|
||||
|
||||
@@ -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"] }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use yaserde_derive::{YaDeserialize, YaSerialize};
|
||||
use einvoice_deps_yaserde_derive::{YaDeserialize, YaSerialize};
|
||||
#[derive(YaSerialize, YaDeserialize, uniffi::Record)]
|
||||
#[yaserde(
|
||||
default_namespace = "",
|
||||
|
||||
12
src/lib.rs
12
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<InvoiceStandard, InvoiceError> {
|
||||
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) => {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user