iot-core 0.0.1

Core types for the iot-protocols SDK: Thing model, IotClient trait, errors, paths, protocol bindings.
Documentation
//! JSON-Schema validation of [`crate::Thing`] payloads.
//!
//! This module is gated behind the `validate` feature. The full schema
//! validator lands in M0 polish — for now this is an intentional stub so
//! that downstream crates can refer to `iot_core::schema` once the feature
//! is on, without forcing the dependency to land in the M0 cut.
//!
//! TODO(M8): Vendor the Ditto Thing JSON-Schema and a minimal validator
//! (e.g. `jsonschema-no-std` or a bespoke sub-set walker), wire to
//! `Thing::validate(&self) -> Result<(), ValidationError>`.

use crate::error::IotResult;

/// Validation error — placeholder. Will become a structured type in M8.
#[derive(Debug)]
pub struct ValidationError(pub &'static str);

impl core::fmt::Display for ValidationError {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "validation error: {}", self.0)
    }
}

impl core::error::Error for ValidationError {}

/// Validate a Thing — currently a no-op success.
#[cfg(feature = "alloc")]
pub fn validate(_thing: &crate::thing::Thing) -> IotResult<()> {
    Ok(())
}