Skip to main content

Module validation

Module validation 

Source
Expand description

JSON Schema + cross-field validation for product group-specific DPP data.

The schema step resolves against the crate’s embedded VersionedSchemaRegistry — built once from the compile-time schemas — at the version the ProductGroupCatalog marks current for the product group; there are no per-product group validators and no hardcoded versions here. Schemas registered at runtime into a separate registry instance are not seen by these free functions (nor by Passport::validate); validate against those through that registry directly (its fail-closed validate_strict). Cross-field regulatory rules (which JSON Schema cannot express, e.g. “fibre percentages sum to ~100%”) come from dpp-rules via the dpp-domain adapters.

Note: excluded from wasm32 builds since jsonschema depends on reqwest’s blocking API.

§Module layout

Re-exports§

pub use batch::BatchValidationItem;
pub use batch::batch_errors;
pub use batch::validate_product_group_data_batch;
pub use functions::validate_passport;
pub use functions::validate_product_group_data;
pub use functions::validate_product_group_data_with_registry;
pub use functions::validate_raw_product_group_data;
pub use personal_data::PERSONAL_DATA_MARK;
pub use personal_data::check_personal_data;
pub use personal_data::personal_data_marks;
pub use rules::battery_recycled_chemistry_conflicts;
pub use rules::unsold_goods_annex_vii_heading;
pub use rules::unsold_goods_cn_depth_is_correct;
pub use rules::validate_battery_operating_temp;
pub use rules::validate_fibre_composition;
pub use rules::validate_surfactants;
pub use rules::validate_svhc_substances;
pub use validator::ProductGroupValidator;
pub use validator::ProductGroupValidatorRegistry;

Modules§

batch
Batch validation of multiple product group-data items in one pass.
functions
ProductGroup-data validation: JSON Schema (via the versioned registry) plus cross-field regulatory rules that JSON Schema cannot express.
personal_data
The personal-data check: a marked field with a value needs a statement, and a statement needs a marked field.
rules
Validation helpers for product group payload lists.
validator
Runtime-registered product group validator trait and registry — the extensibility seam for product groups not known to this crate at compile time.