pub mod columns;
pub mod conformance;
pub mod gate;
pub mod typed;
pub use columns::{
MAKO_PREISTYP_ATTRIBUT, MaloShadowColumns, MeloShadowColumns, StandorteigenschaftenError,
ZaehlerShadowColumns, geraet_typ, is_bo4e_preistyp, malo_enum_check_lists,
melo_enum_check_lists, nelo_enum_check_lists, partner_enum_check_lists, position_preistyp,
};
pub use conformance::Bo4eConformance;
pub use gate::{
Bo4eRejection, Bo4eSerialiseError, Bo4eTyped, decode, decode_received, ensure_conformant,
to_canonical_json,
};
pub use rubo4e::validation::ValidationFailure;
pub use typed::{Bo4e, REJECTION_SENTINEL, recover_rejection};
use rubo4e::current::Marktlokation;
pub const SCHEMA_VERSION: &str = Marktlokation::SCHEMA_VERSION;
#[must_use]
pub fn schema_version() -> String {
SCHEMA_VERSION.to_owned()
}
pub const SCHEMA_SERIES: &str = Marktlokation::SCHEMA_SERIES;
#[must_use]
pub fn version_is_readable(stored: &str) -> bool {
stored.strip_prefix('v').unwrap_or(stored).split('.').next() == Some(SCHEMA_SERIES)
}
#[cfg(test)]
mod schema_version_tests {
#[test]
fn the_schema_version_is_the_linked_crates_own() {
use rubo4e::Bo4eTyped as _;
assert_eq!(
super::schema_version(),
rubo4e::current::Vertrag::SCHEMA_VERSION,
"every BO in a schema series reports the same version"
);
assert!(
!super::schema_version().starts_with('v'),
"the payload spelling carries no `v`; only the git tag does"
);
assert_eq!(
super::schema_version().split('.').next(),
Some(super::SCHEMA_SERIES),
"the series is the release's own YYYYMM prefix"
);
}
#[test]
fn the_series_decides_what_is_readable() {
let series = super::SCHEMA_SERIES;
assert!(super::version_is_readable(&super::schema_version()));
assert!(super::version_is_readable(&format!("{series}.9.9")));
assert!(super::version_is_readable(&format!("v{series}.0.0")));
assert!(!super::version_is_readable("202501.0.0"));
assert!(!super::version_is_readable(""));
}
}