| Crates.io | oxa-types |
| lib.rs | oxa-types |
| version | 0.1.0 |
| created_at | 2025-12-23 23:13:36.144573+00 |
| updated_at | 2025-12-24 02:25:42.692447+00 |
| description | Rust types generated from the OXA schema |
| homepage | |
| repository | https://github.com/oxa-dev/oxa |
| max_upload_size | |
| id | 2002513 |
| size | 10,621 |
Rust types generated from the OXA schema.
Add this to your Cargo.toml:
[dependencies]
oxa-types = "0.1"
use oxa_types::{Document, Block, Paragraph, Inline, Text};
fn main() {
// Parse from JSON
let json = r#"{
"type": "Document",
"metadata": {},
"title": [],
"children": [
{
"type": "Paragraph",
"classes": [],
"data": {},
"children": [
{"type": "Text", "classes": [], "data": {}, "value": "Hello, world!"}
]
}
]
}"#;
let doc: Document = serde_json::from_str(json).unwrap();
println!("{:?}", doc);
// Serialize back to JSON
let output = serde_json::to_string_pretty(&doc).unwrap();
println!("{}", output);
}
The type field uses monostate::MustBe! to ensure type-safe deserialization - each struct only accepts its specific type value.
The types in this crate are auto-generated from the OXA JSON Schema. Do not edit src/lib.rs directly. Instead:
schema/pnpm codegen rs to regenerate the Rust types