backbone-inventory 0.10.1

Inventory: stock ledger of record (SLE) + moving-average valuation; emits COGS/asset AccountingPost (Delivery/Receipt -> GL)
Documentation
//! Validator for Location entity
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! Returns an `EntityValidator<Location>` pre-loaded with schema-derived
//! field rules. Extend in the `// <<< CUSTOM` zone.

use backbone_core::{EntityValidator, ValidationErrors, ValidationError};
use backbone_core::{OptionalNotBlank, RequiredString};
use crate::domain::entity::Location;

/// Validator type alias for Location entities.
pub type LocationValidator = EntityValidator<Location>;

/// Build a validator for Location with all schema-defined field rules.
pub fn location_validator() -> LocationValidator {
    EntityValidator::new()
        .rule(RequiredString::new("name", |e: &Location| &e.name))
        .rule(RequiredString::new("complete_name", |e: &Location| &e.complete_name))
        .rule(RequiredString::new("parent_path", |e: &Location| &e.parent_path))
        .rule(OptionalNotBlank::new("barcode", |e: &Location| e.barcode.as_deref()))
    // <<< CUSTOM RULES
    // END CUSTOM RULES
}

// <<< CUSTOM
// END CUSTOM