einvoice-validator
Validate EN 16931 and Peppol BIS Billing 3.0 e-invoices against the official validation artefacts, in pure Rust: no JVM, no C library, no FFI.
A Validator is built once from a rule set (the XML schema it names loaded, its official
compiled XSLT stylesheets prepared), is Send + Sync, and validates any number of
documents. Each validation runs the XML check (UTF-8, well-formed, no document type
declaration), the UBL 2.1 schema with einvoice-xsd,
then every stylesheet of the rule set with
einvoice-xslt-exec, which executes the
official compiled Schematron with the behaviour of Saxon-HE 12.10. The Report holds the
schema errors, the findings of each stylesheet (failed asserts and successful reports with
their id, flag, location and message), the raw SVRL and the verdict.
[]
= "0.1"
use ;
Rule sets
- Built in:
cen-ubl, the CEN EN 16931 validation artefacts for UBL, release 1.3.17, embedded unmodified (default featurecen-ubl). - Bundles: a directory or in-memory set of files with a
bundle.tomlmanifest naming the stylesheets and their SHA-256 (Validator::from_bundle_dir,Validator::from_bundle). Peppol BIS Billing 3.0 is used this way, since its files may not be redistributed: the repository'sscripts/fetch-peppol.shdownloads the pinned release, compiles its stylesheets and writes the manifest.
On every case of the test corpora of CEN EN 16931 UBL 1.3.17 and Peppol BIS Billing 3.0.22,
the verdicts and findings agree with Saxon-HE. The crate also builds for
wasm32-unknown-unknown, where the caller gives the clock. The command-line tool is
einvoice-cli (einvoice-validate).
This crate is part of einvoice-validator. Documentation: https://docs.rs/einvoice-validator.
Licence
MIT AND EUPL-1.2: the code is MIT, and the default feature cen-ubl embeds the CEN
EN 16931 stylesheet, vendored unmodified in bundles/cen-ubl/, which is under the EUPL-1.2.
Built with default-features = false, the crate embeds no rule set. Through
einvoice-xsd, a program also embeds the OASIS UBL 2.1 schemas, which keep their own terms
(OASIS, UN/CEFACT, W3C). The texts are in LICENSES/ of each crate, and
einvoice_validator::licences() returns all of them, for programs that must show them to
their users.