Nickel Integration
Type-safe form schema generation using Nickel configuration language.
Files
- nickel_schema.ncl - Type-safe form schema definition
- nickel_template.ncl.j2 - Jinja2 template for schema generation
About Nickel
Nickel is a powerful configuration language that provides:
- Strong typing
- Validation rules
- Reusable schemas
- Inheritance and composition
Usage
Generate Form from Nickel Schema
# Process template through Jinja2
j2 nickel_template.ncl.j2 > form_schema.ncl
# Generate TOML from Nickel
nickel eval nickel_schema.ncl > form_config.toml
# Run form
cargo run -p typedialog-web -- --config form_config.toml
Example Nickel Schema
{
form = {
title = "Registration",
fields = {
email = {
type = "email",
required = true,
label = "Email Address",
}
}
}
}
Benefits
- Type Safety - Catch schema errors at compile time
- Inheritance - Reuse common field definitions
- Validation - Built-in schema validation
- Macros - Generate repetitive fields
- Documentation - Self-documenting schemas
Advanced Features
- Field inheritance
- Custom validators
- Conditional schemas
- Template-driven generation
- Schema composition