pub fn validate_app_data_doc(doc: &AppDataDoc) -> ValidationResultExpand description
Validate an AppDataDoc against all CoW Protocol app-data rules.
Runs up to three independent checks and merges their results into a
single ValidationResult:
- Version check —
versionmust be non-empty and parse as semverx.y.z. - Business-rule constraints —
appCodelength, hook address format,partnerFeebasis-point caps, and similar field-level rules enforced by the privatevalidationhelper module. - JSON Schema validation — (only when the
schema-validationfeature is enabled; on by default for native targets, off by default on wasm) the serialised document is checked against the bundled upstream schema via theschemamodule, catching structural drift that the hand-written business rules do not cover (missing required fields, unknown properties, regex violations,anyOfvariants, …).
Returns a ValidationResult that lists every violation found. An
empty ValidationResult::typed_errors list means the document is
fully valid.
§Example
use cow_app_data::{AppDataDoc, validate_app_data_doc};
let doc = AppDataDoc::new("CoW Swap");
let result = validate_app_data_doc(&doc);
assert!(result.is_valid());
assert!(!result.has_errors());