| Crates.io | rust-ts-json-compiler |
| lib.rs | rust-ts-json-compiler |
| version | 0.2.0 |
| created_at | 2023-10-24 10:08:33.393943+00 |
| updated_at | 2023-11-20 13:56:37.453669+00 |
| description | ts-zod compiller to json |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1012226 |
| size | 29,381 |
Compiles zod schema to valid json payload.
pub fn main() {
let zod_schema = "
z.object({
products: z.array(
z.object({
productId: z.number().int(),
amount: z.number().int(),
price: z.number()
})
),
cityId: z.number().int(),
comment: z.string()
})
";
let json_schema = rust_ts_json_compiler::to_json(zod_schema);
/*
{
"products": [
{
"productId": 1,
"amount": 1,
"price": 5
}
],
"cityId": 1,
"comment": "string"
}
*/
println!("{}", json_schema);
}