Skip to main content

Crate anyrepair

Crate anyrepair 

Source
Expand description

§AnyRepair

A Rust crate for repairing malformed structured data including JSON, YAML, XML, TOML, CSV, INI, Markdown, and Diff with format auto-detection.

Re-exports§

pub use diff::DiffRepairer;
pub use error::RepairError;
pub use error::Result;
pub use json::JsonRepairer;
pub use key_value::EnvRepairer;
pub use key_value::IniRepairer;
pub use key_value::PropertiesRepairer;
pub use mcp_server::AnyrepairMcpServer;
pub use streaming::StreamingRepair;
pub use traits::Repair;

Modules§

csv
CSV repair module
diff
Diff/Unified diff repair module
error
Error types for the anyrepair crate
format_detection
Format detection heuristics
json
JSON repair module
json_util
Minimal JSON helpers (validation, escaping, MCP payloads) without serde.
key_value
Key-value format repair module (INI, .env, .properties)
markdown
Markdown repair module
mcp_server
MCP (Model Context Protocol) server for anyrepair
repairer_base
Generic repair loop: validator gate + ordered RepairStrategy pipeline.
streaming
Streaming repair for large files with minimal memory overhead
toml
TOML repair module
traits
Core traits for repair functionality
xml
XML repair module
yaml
YAML repair functionality

Constants§

SUPPORTED_FORMATS
All format identifiers supported by anyrepair. Used by create_repairer, create_validator, and repair_with_format.

Functions§

create_repairer
Create a boxed Repair instance for the given format. Accepts canonical names and aliases (e.g. yml, md). Returns RepairError::FormatDetection if the format is unknown.
create_validator
Create a boxed Validator for the given format. Accepts canonical names and aliases (e.g. yml, md). Returns RepairError::FormatDetection if the format is unknown.
detect_format
Detect the format of the given content. Returns None if no known format matches. See format_detection for the heuristic order.
jsonrepair
Repair a JSON string (Python-compatible convenience function). Equivalent to create_repairer("json")?.repair(json_str).
normalize_format
Normalize a format alias to its canonical name. Accepts case-insensitive matches and common aliases (ymlyaml, mdmarkdown). Returns the original string unchanged if no match is found.
repair
Repair content with automatic format detection. Falls back to the Markdown repairer if no format is detected.
repair_with_explanations
Repair content with a specific format and return the list of strategies that changed it. Returns (repaired_content, applied_strategy_names).
repair_with_format
Repair content using an explicit format. Convenience wrapper around create_repairer + Repair::repair.