schema2struct: JSON Schema to Rust Struct Generator
A powerful procedural macro for generating type-safe Rust structs from JSON Schema definitions with compile-time validation and Serde integration.
Features
-
Automatic struct generation from JSON Schema
-
Compile-time type checking
-
Support for complex nested schemas
-
Constraint validation
-
Zero-cost abstraction
Installation
Add the following to your Cargo.toml
:
[]
= "0.1"
= { = "1.0", = ["derive"] }
= "1.0"
Quick Start
Basic Usage
use schema2struct;
schema2struct!
Output
pub static USER_JSON_VALUE: LazyLock = new;
more complex usages can be found in the examples folder
License
Distributed under the MIT License. See LICENSE for more information.