use typeshift::typeshift;
#[typeshift]
#[derive(Debug)]
struct User {
#[validate(length(min = 3))]
name: String,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let user: User = typeshift::parse_str(r#"{"name":"Ada"}"#)?;
let json = typeshift::to_json(&user)?;
let schema = typeshift::schema_json::<User>();
println!("parsed: {user:?}");
println!("json: {json}");
println!("schema type: {}", schema["type"]);
Ok(())
}