backbone-integrations 0.6.0

Integration registry: connectors, integration accounts and an idempotent inbound event lane, with one OAuth flow (HMAC-bound state, PKCE)
Documentation
//! Validator for IntegrationEvent entity
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! Returns an `EntityValidator<IntegrationEvent>` 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::IntegrationEvent;

/// Validator type alias for IntegrationEvent entities.
pub type IntegrationEventValidator = EntityValidator<IntegrationEvent>;

/// Build a validator for IntegrationEvent with all schema-defined field rules.
pub fn integration_event_validator() -> IntegrationEventValidator {
    EntityValidator::new()
        .rule(RequiredString::new("event_type", |e: &IntegrationEvent| &e.event_type))
        .rule(RequiredString::new("external_id", |e: &IntegrationEvent| &e.external_id))
        .rule(RequiredString::new("business_key", |e: &IntegrationEvent| &e.business_key))
        .rule(RequiredString::new("payload", |e: &IntegrationEvent| &e.payload))
        .rule(OptionalNotBlank::new("mapped_ref_type", |e: &IntegrationEvent| e.mapped_ref_type.as_deref()))
        .rule(OptionalNotBlank::new("error_detail", |e: &IntegrationEvent| e.error_detail.as_deref()))
    // <<< CUSTOM RULES
    // END CUSTOM RULES
}

// <<< CUSTOM
// END CUSTOM