isonantic-rs
Type-safe validation and schema definitions for ISON format in Rust.
Features
- Type-safe schemas - Define ISON table schemas with full type safety
- Validation - Runtime validation with detailed error messages
- Builder pattern - Fluent API for defining fields and constraints
- Custom validators - Add custom validation logic
Installation
[]
= "1.0"
= "1.0"
Quick Start
use *;
use parse;
Schema Types
String Fields
string // Basic string
.min // Minimum length
.max // Maximum length
.email // Email format validation
.required // Required field
.default_value // Default value
Number Fields
int // Integer field
.min // Minimum value
.max // Maximum value
.positive // Must be > 0
.required
float // Float field
.min
.max
.positive
Boolean Fields
boolean
.default_value
.required
Reference Fields
reference // ISON reference (:id or :type:id)
.required
Table Schema
let schema = table
.field
.field
.field
.field;
let orders = schema.validate?;
Custom Validators
use *;
// Built-in validators
string.not_empty
string.one_of
// Custom validator
let validator = custom;
Error Handling
match schema.validate
Accessing Validated Data
let users = schema.validate?;
// Iterate rows
for row in users.iter
// Index access
let first_user = &users;
Test Results
All tests passing:
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Doc-tests isonantic_rs
running 1 test
test packages\isonantic-rust\src\lib.rs - (line 7) - compile ... ok
test result: ok. 1 passed; 0 failed; 0 ignored
Run tests with:
Links
License
MIT License - see LICENSE for details.