Expand description
Schema version parsing and compatibility validation for shipper state files.
This module was folded in from the former shipper-schema crate in Phase 6
of the decrating effort (see docs/decrating-plan.md).
Schema version parsing and compatibility validation for shipper state files.
Shipper persists state and receipt files on disk with a version tag in the
form shipper.<doctype>.v<N> (for example, shipper.receipt.v2). This
module provides the parsing and compatibility helpers used when loading
those files.
Historically these helpers lived in a dedicated shipper-schema crate.
Phase 6 of the decrating effort folded that crate in here because the
public surface was only two functions with no independent consumers.
§Examples
use shipper_types::schema::{parse_schema_version, validate_schema_version};
assert_eq!(parse_schema_version("shipper.receipt.v2").unwrap(), 2);
assert!(validate_schema_version(
"shipper.receipt.v2",
"shipper.receipt.v1",
"receipt",
)
.is_ok());Functions§
- parse_
schema_ version - Parse schema version number from a string like
shipper.receipt.v2. - validate_
schema_ version - Validate that
versionis at least the minimum supported schema version.