{"id":51002582,"url":"https://github.com/muhammad-fiaz/adapters","last_synced_at":"2026-06-20T16:32:38.449Z","repository":{"id":358596586,"uuid":"1242033327","full_name":"muhammad-fiaz/adapters","owner":"muhammad-fiaz","description":"A fast, high-performance structured schema validation, serialization, and transformation library for Rust.","archived":false,"fork":false,"pushed_at":"2026-05-18T06:23:57.000Z","size":129,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-18T06:44:49.388Z","etag":null,"topics":["adapters","deserialization","rust","rust-adapters","rust-crate","rust-library","rust-macros","rust-serialization","serialization"],"latest_commit_sha":null,"homepage":"https://muhammad-fiaz.github.io/adapters/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muhammad-fiaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["muhammad-fiaz"],"ko_fi":"muhammadfiaz","custom":["https://pay.muhammadfiaz.com"]}},"created_at":"2026-05-18T04:24:44.000Z","updated_at":"2026-05-18T06:24:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/muhammad-fiaz/adapters","commit_stats":null,"previous_names":["muhammad-fiaz/adapters"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/muhammad-fiaz/adapters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fadapters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fadapters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fadapters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fadapters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhammad-fiaz","download_url":"https://codeload.github.com/muhammad-fiaz/adapters/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fadapters/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34578089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapters","deserialization","rust","rust-adapters","rust-crate","rust-library","rust-macros","rust-serialization","serialization"],"created_at":"2026-06-20T16:32:37.421Z","updated_at":"2026-06-20T16:32:38.444Z","avatar_url":"https://github.com/muhammad-fiaz.png","language":"Rust","funding_links":["https://github.com/sponsors/muhammad-fiaz","https://ko-fi.com/muhammadfiaz","https://pay.muhammadfiaz.com"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg alt=\"rust logo\" src=\"https://github.com/user-attachments/assets/79881f0c-dbed-4e76-b347-40da3e3ecd97\" /\u003e\n\u003ch1\u003eAdapters\u003c/h1\u003e\n\u003ca href=\"https://muhammad-fiaz.github.io/adapters/\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-muhammad--fiaz.github.io-blue\" alt=\"Documentation\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.rust-lang.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Rust-Edition%202024-orange.svg?logo=rust\" alt=\"Rust Edition\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/muhammad-fiaz/adapters\" alt=\"GitHub stars\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/muhammad-fiaz/adapters\" alt=\"GitHub issues\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters/pulls\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-pr/muhammad-fiaz/adapters\" alt=\"GitHub pull requests\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters\"\u003e\u003cimg src=\"https://img.shields.io/github/last-commit/muhammad-fiaz/adapters\" alt=\"GitHub last commit\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters\"\u003e\u003cimg src=\"https://img.shields.io/github/license/muhammad-fiaz/adapters\" alt=\"License\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/muhammad-fiaz/adapters/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/platforms-linux%20%7C%20windows%20%7C%20macos-blue\" alt=\"Supported Platforms\"\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters/actions/workflows/github-code-scanning/codeql\"\u003e\u003cimg src=\"https://github.com/muhammad-fiaz/adapters/actions/workflows/github-code-scanning/codeql/badge.svg\" alt=\"CodeQL\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters/actions/workflows/release.yml\"\u003e\u003cimg src=\"https://github.com/muhammad-fiaz/adapters/actions/workflows/release.yml/badge.svg\" alt=\"Release\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/adapters/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/muhammad-fiaz/adapters?label=Latest%20Release\u0026style=flat-square\" alt=\"Latest Release\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pay.muhammadfiaz.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/Sponsor-pay.muhammadfiaz.com-ff69b4?style=flat\u0026logo=heart\" alt=\"Sponsor\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/sponsors/muhammad-fiaz\"\u003e\u003cimg src=\"https://img.shields.io/badge/Sponsor-💖-pink?style=social\u0026logo=github\" alt=\"GitHub Sponsors\"\u003e\u003c/a\u003e\n\u003ca href=\"https://hits.sh/muhammad-fiaz/adapters/\"\u003e\u003cimg src=\"https://hits.sh/muhammad-fiaz/adapters.svg?label=Visitors\u0026extraCount=0\u0026color=green\" alt=\"Repo Visitors\"\u003e\u003c/a\u003e\n\n\u003cp\u003e\u003cem\u003eA fast, high-performance structured schema validation, serialization, and transformation library for Rust.\u003c/em\u003e\u003c/p\u003e\n\n\u003cb\u003e\u003ca href=\"https://muhammad-fiaz.github.io/adapters/\"\u003eDocumentation\u003c/a\u003e |\n\u003ca href=\"https://muhammad-fiaz.github.io/adapters/api\"\u003eAPI Reference\u003c/a\u003e |\n\u003ca href=\"https://muhammad-fiaz.github.io/adapters/getting-started\"\u003eQuick Start\u003c/a\u003e |\n\u003ca href=\"CONTRIBUTING.md\"\u003eContributing\u003c/a\u003e\u003c/b\u003e\n\n\u003c/div\u003e\n\nA production-grade, high-performance schema and data transformations library for Rust, designed with a clean, intuitive, and developer-friendly API.\n\n\u003e [!NOTE]\n\u003e This Project aims to be production ready, while it is relatively new project you can find some interesting features which may simplify your Rust project structured validations and data transformations.\n\n**⭐️ If you love `adapters`, make sure to give it a star! ⭐️**\n\n---\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eTable of Contents\u003c/strong\u003e (click to expand)\u003c/summary\u003e\n\n- [Prerequisites](#prerequisites)\n- [Supported Platforms](#supported-platforms)\n- [Installation](#installation)\n  - [Method 1: Cargo Add (Recommended)](#method-1-cargo-add-recommended)\n  - [Method 2: Manual Cargo.toml Configuration](#method-2-manual-cargotoml-configuration)\n- [Quick Start](#quick-start)\n- [Usage Examples](#usage-examples)\n  - [Basic Declarative Validation](#basic-declarative-validation)\n  - [Advanced Macro Validations](#advanced-macro-validations)\n  - [Programmatic Builder Validation](#programmatic-builder-validation)\n  - [Nested Model Validation](#nested-model-validation)\n  - [Field Transformation Pipelines](#field-transformation-pipelines)\n  - [Alias Key Remapping](#alias-key-remapping)\n- [Declarative Macro Reference Table](#declarative-macro-reference-table)\n- [Performance \u0026 Benchmarks](#performance--benchmarks)\n- [Building \u0026 Testing](#building--testing)\n- [Documentation](#documentation)\n  - [Online Documentation](#online-documentation)\n  - [Generating Local Documentation](#generating-local-documentation)\n- [Contributing](#contributing)\n- [License](#license)\n- [Links](#links)\n\n\u003c/details\u003e\n\n----\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eFeatures of Adapters\u003c/strong\u003e (click to expand)\u003c/summary\u003e\n\n| Feature | Description | Documentation |\n|---------|-------------|---------------|\n| **Declarative Derive Macro** | User-friendly data modeling interface via `#[derive(Schema)]` | [Docs](https://muhammad-fiaz.github.io/adapters/schema-validation) |\n| **Comprehensive Field Rules** | email, url, min/max bounds, regex, non_empty, alphanumeric, positive, negative, and non_zero | [Docs](https://muhammad-fiaz.github.io/adapters/api) |\n| **Coercion \u0026 Strict Mode** | Optional strict type enforcement to prevent implicit casting / type parsing | [Docs](https://muhammad-fiaz.github.io/adapters/schema-validation) |\n| **Dynamic Schema Builders** | Build complex nested structural validations dynamically at runtime | [Docs](https://muhammad-fiaz.github.io/adapters/schema-validation) |\n| **Robust Parsing Engine** | Native structured JSON parsing with precise escape seq bounds | [Docs](https://muhammad-fiaz.github.io/adapters/serialization) |\n| **Functional Pipelines** | Chain value adjustments, defaults, transformations, and filters cleanly | [Docs](https://muhammad-fiaz.github.io/adapters/transformation) |\n| **Nested Validation Error Paths** | Accumulates nested object failures using accurate dot-notation paths | [Docs](https://muhammad-fiaz.github.io/adapters/schema-validation) |\n\n\u003c/details\u003e\n\n----\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003ePrerequisites \u0026 Supported Platforms\u003c/strong\u003e (click to expand)\u003c/summary\u003e\n\n\u003cbr\u003e\n\n## Prerequisites\n\nBefore installing Adapters, ensure you have the following:\n\n| Requirement | Version | Notes |\n|-------------|---------|-------|\n| **Rust** | Stable 1.85+ | 2024 Edition supported natively |\n| **Operating System** | Windows, Linux, macOS | Cross-platform |\n\n---\n\n## Supported Platforms\n\nAdapters supports a wide range of platforms and architectures:\n\n| Platform | Architectures | Status |\n|----------|---------------|--------|\n| **Windows** | x86_64, aarch64, x86 | Full support |\n| **Linux** | x86_64, aarch64, riscv64 | Full support |\n| **macOS** | x86_64, aarch64 (Apple Silicon) | Full support |\n\n\u003c/details\u003e\n\n---\n\n## Installation\n\n### Method 1: Cargo Add (Recommended)\n\nAdd **Adapters** to your cargo project dynamically:\n\n```bash\ncargo add adapters\n```\n\n### Method 2: Manual Cargo.toml Configuration\n\nAdd this directly to your `Cargo.toml` dependencies block:\n\n```toml\n[dependencies]\nadapters = \"0.0.0\"\n```\n\n---\n\n## Quick Start\n\n```rust\nuse adapters::prelude::*;\n\n#[derive(Schema, Debug)]\nstruct UserRegistration {\n    #[schema(min_length = 3, max_length = 20, alphanumeric)]\n    username: String,\n\n    #[schema(email)]\n    email: String,\n\n    #[schema(positive)]\n    age: u8,\n}\n\nfn main() -\u003e Result\u003c(), Error\u003e {\n    let raw_payload = r#\"{\n        \"username\": \"Fiaz2026\",\n        \"email\": \"contact@example.com\",\n        \"age\": 28\n    }\"#;\n\n    // Direct structural deserialization \u0026 validation\n    let user = UserRegistration::from_json(raw_payload)?;\n    println!(\"Successfully validated user: {:?}\", user);\n\n    Ok(())\n}\n```\n\n---\n\n## Usage Examples\n\n### Basic Declarative Validation\n\n```rust\nuse adapters::prelude::*;\n\n#[derive(Schema)]\nstruct SimpleUser {\n    name: String,\n    #[schema(optional, default = \"Guest\")]\n    role: String,\n}\n```\n\n### Advanced Macro Validations\n\n```rust\nuse adapters::prelude::*;\n\n#[derive(Schema)]\nstruct SecureAsset {\n    #[schema(non_empty, alphanumeric)]\n    serial_code: String,\n\n    #[schema(positive)]\n    quantity: i32,\n\n    #[schema(negative)]\n    balance_deficit: f64,\n\n    #[schema(non_zero)]\n    tracking_id: i64,\n}\n```\n\n### Programmatic Builder Validation\n\n```rust\nuse adapters::prelude::*;\nuse adapters::schema::{ObjectSchema, StringSchema, IntegerSchema};\nuse adapters::SchemaValidator;\n\nlet schema = ObjectSchema::new()\n    .field(\"username\", StringSchema::new().required().non_empty().alphanumeric())\n    .field(\"age\", IntegerSchema::new().required().min(18).positive());\n```\n\n### Nested Model Validation\n\n```rust\nuse adapters::prelude::*;\n\n#[derive(Schema)]\nstruct Address {\n    city: String,\n    country: String,\n}\n\n#[derive(Schema)]\nstruct Profile {\n    name: String,\n    address: Address, // Child schema validated recursively!\n}\n```\n\n### Field Transformation Pipelines \u0026 Sanitization\n\nChaining data mapping and sanitization rules is highly expressive using functional pipelines. This is exceptionally useful when consuming legacy third-party Webhook payloads:\n\n```rust\nuse adapters::prelude::*;\nuse adapters::transform::{Pipeline, FieldMapper};\n\n// Create a field mapper to rename legacy API keys\nlet legacy_mapper = FieldMapper::new()\n    .rename(\"txt_title\", \"title\")\n    .rename(\"usr_id\", \"user_id\");\n\n// Build a transformation pipeline\nlet pipeline = Pipeline::new()\n    .push(legacy_mapper)\n    .push(|mut value: Value| {\n        // Custom sanitization: Force uppercase on the \"title\" key if present\n        if let Some(obj) = value.as_object_mut() {\n            if let Some(Value::String(s)) = obj.get_mut(\"title\") {\n                *s = s.to_uppercase();\n            }\n        }\n        Ok(value)\n    });\n\n// Process a raw legacy payload\nlet legacy_payload = Value::Object(\n    [\n        (\"txt_title\".to_string(), Value::String(\"Adapters Guide\".into())),\n        (\"usr_id\".to_string(), Value::Int(99)),\n    ]\n    .into_iter()\n    .collect()\n);\n\nlet clean_value = pipeline.run(legacy_payload).unwrap();\nprintln!(\"Transformed payload: {:?}\", clean_value);\n// Output will have \"title\" in uppercase, and \"usr_id\" renamed to \"user_id\"!\n```\n\n### Alias Key Remapping\n\nIf you don't need runtime pipelines and only require direct structural key mapping from your JSON API payloads, use the `#[schema(alias = \"...\")]` helper:\n\n```rust\nuse adapters::prelude::*;\n\n#[derive(Schema, Debug)]\nstruct ApiConfig {\n    /// Remaps \"serverPort\" in JSON directly to \"port\" in Rust\n    #[schema(alias = \"serverPort\")]\n    port: u16,\n\n    /// Remaps \"db_host_name\" in JSON directly to \"host\" in Rust\n    #[schema(alias = \"db_host_name\")]\n    host: String,\n}\n```\n\n---\n\n## Declarative Macro Reference Table\n\nConfigure your struct fields using the `#[schema(...)]` helper:\n\n| Attribute Rule | Supported Types | Action Description |\n| :--- | :--- | :--- |\n| `min_length = \u003cusize\u003e` | `String` | Enforces a minimum string character count. |\n| `max_length = \u003cusize\u003e` | `String` | Enforces a maximum string character count. |\n| `non_empty` | `String` | Restricts string to be non-empty (minimum 1 character). |\n| `alphanumeric` | `String` | Enforces only alphanumeric characters. |\n| `email` | `String` | Matches the string value against standard RFC 5322 format. |\n| `url` | `String` | Matches the string value against standard URL layout. |\n| `regex = \"\u003cpattern\u003e\"` | `String` | Validates string matching using custom Rust regex. |\n| `min = \u003cnumber\u003e` | All numbers | Restricts numbers to be greater than or equal to value. |\n| `max = \u003cnumber\u003e` | All numbers | Restricts numbers to be less than or equal to value. |\n| `positive` | All numbers | Checks if numbers are strictly positive ($\u003e0$). |\n| `negative` | All numbers | Checks if numbers are strictly negative ($\u003c0$). |\n| `non_zero` | All numbers | Restricts numbers to exclude exact $0$ value. |\n| `optional` | All types | Declares the field is non-required and defaults to null. |\n| `strict` | All types | Opts into strict validation: no implicit type coercions. |\n| `default = \u003cexpr\u003e` | All types | Populates field with expression value when key is absent. |\n\n---\n\n## Performance \u0026 Benchmarks\n\nAdapters is engineered for extreme data validation and parsing throughput. It implements high-performance zero-allocation parsing routines, compact error trees, and static struct validation maps.\n\nTo run benchmarks locally:\n\n```bash\ncargo bench\n```\n\n---\n\n## Building \u0026 Testing\n\n```bash\n# Check compiler requirements and clippy lints\ncargo clippy --workspace --all-targets -- -D warnings\n\n# Run all unit, integration, and doctests\ncargo test --workspace --all-targets\n```\n\n---\n\n## Documentation\n\n### Online Documentation\nFull structured guide and dynamic api walkthroughs are available natively at:\nhttps://muhammad-fiaz.github.io/adapters\n\n### Generating Local Documentation\nTo generate and view crate-level API documentation locally:\n\n```bash\ncargo doc --no-deps --open\n```\n\n---\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.\n\n---\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n---\n\n## Links\n\n- **Documentation**: https://muhammad-fiaz.github.io/adapters\n- **Repository**: https://github.com/muhammad-fiaz/adapters\n- **Issues**: https://github.com/muhammad-fiaz/adapters/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fadapters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhammad-fiaz%2Fadapters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fadapters/lists"}