This roadmap outlines future features for domainstack, ranked by impact and alignment with the library's philosophy of "write once, derive everything."
The core library is production-ready with:
- Derive macro for validation (
Validate,ToSchema,ValidateOnDeserialize) - Tuple struct (newtype) support -
#[derive(Validate)]forstruct Email(String) - Enum validation support -
#[derive(Validate)]for enums with all variant types - 37+ built-in validation rules
- OpenAPI 3.0 schema generation
- Framework adapters (Axum, Actix, Rocket)
- Async validation with context
- Type-state validation
- Nested validation with path tracking
- Serde integration (validate on deserialize)
- Code generation CLI (
domainstack-cli) with Zod and JSON Schema support - CLI watch mode -
--watchflag for automatic regeneration on file changes - JSON Schema generation -
domainstack json-schemacommand for Draft 2020-12 schemas - WASM browser validation (
domainstack-wasm)
Status: Partially Complete (JSON Schema done, others planned) Impact: 🔥🔥🔥 Very High Effort: Medium per generator
The CLI architecture supports multiple generators. Current status:
# ✅ Available now
domainstack zod --input src --output frontend/schemas.ts
domainstack json-schema --input src --output schemas/schema.json
# Planned additions:
# Yup schemas (popular React form library)
domainstack yup --input src --output frontend/schemas.ts
# GraphQL SDL with validation directives
domainstack graphql --input src --output schema.graphql
# Prisma schema generation
domainstack prisma --input src --output prisma/schema.prismaBenefits:
- Single source of truth across all platforms
- Support for major frontend validation libraries
- API gateway integration (JSON Schema ✅)
- Database schema generation (Prisma)
Status: Planned Impact: 🔥🔥 High Effort: Low-Medium
Create a complete example showing WASM browser validation:
examples/
└── wasm-react-demo/
├── rust/
│ └── src/lib.rs # Types with validation
├── frontend/
│ ├── src/App.tsx # React form with WASM validation
│ └── package.json
└── README.md # Step-by-step setup guide
Demonstrates:
- Building WASM module with
wasm-pack - Registering types for validation
- Calling validation from JavaScript/TypeScript
- Displaying field-level errors in React
- Same error structure as server responses
Status: Planned Impact: 🔥🔥 High Effort: Low
Create comprehensive CLI documentation:
# CLI Tutorial: From Rust to TypeScript
## Step 1: Install the CLI
cargo install domainstack-cli
## Step 2: Add validation rules to your Rust types
...
## Step 3: Generate TypeScript schemas
...
## Step 4: Use in your frontend
...Contents:
- Installation and setup
- Basic usage examples
- Handling custom types
- CI/CD integration
- Troubleshooting common issues
Status: Research Impact: 🔥 Medium Effort: Medium
The Actix adapter currently uses futures::executor::block_on() due to Actix-web's sync extractor pattern. Research options:
Current (works, documented limitation):
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future {
ready(match futures::executor::block_on(json_fut) { ... })
}Potential improvements:
- Document the limitation more prominently in README
- Provide alternative truly-async pattern in documentation
- Track Actix-web updates for potential native async extractors
Workaround documentation:
// For truly async extraction, use this pattern:
async fn create_user(
Json(dto): Json<CreateUserDto>
) -> Result<Json<User>, ErrorResponse> {
let user = domainstack_http::into_domain::<User, _>(dto)?;
Ok(Json(user))
}Status: Research Impact: 🔥🔥 High Effort: Medium
Auto-generate test data from validation rules:
#[derive(Validate, Arbitrary)]
struct User {
#[validate(email)]
email: String,
#[validate(range(min = 18, max = 120))]
age: u8,
}
// Auto-generates:
// - Valid users (random emails, ages 18-120)
// - Invalid users for each validation rule
// - Edge cases (age=18, age=120, etc.)Integration with:
proptest- Property-based testingquickcheck- Random test generationarbitrary- Arbitrary trait implementation
Status: Planned Impact: 🔥🔥 High Effort: Medium
Generate SQL constraints from validation rules:
#[derive(Validate, ToMigration)]
struct User {
#[validate(email)]
#[validate(max_len = 255)]
email: String,
#[validate(range(min = 18, max = 120))]
age: u8,
}Generates SQL:
CREATE TABLE users (
email VARCHAR(255) NOT NULL
CHECK (email ~ '^[^@]+@[^@]+\.[^@]+$'),
age INTEGER NOT NULL
CHECK (age >= 18 AND age <= 120)
);Integration with:
sqlx- Compile-time verified queriesdiesel- ORM integrationsea-orm- Async ORM integration
Status: Research Impact: 🔥 Medium Effort: Medium
Multi-language validation error messages:
#[derive(Validate)]
struct User {
#[validate(email)]
#[message(en = "Invalid email format", es = "Formato de correo inválido")]
email: String,
}
// Runtime locale switching
let error = user.validate_with_locale("es")?;Status: Planned Impact: Medium Effort: Low
Auto-generate metrics for validation failures:
#[derive(Validate)]
#[metrics(namespace = "user_service")]
struct User {
#[validate(email)]
email: String,
}Generates Prometheus metrics:
validation_failures_total{field="email", code="invalid_email"} 42
validation_duration_seconds{type="User"} 0.001
Status: Research Impact: Medium Effort: Medium
Track which validation rules are tested:
cargo test --features validation-coverage
Coverage Report:
[ok] User.email (email format): 15 tests
[ok] User.age (range): 12 tests
⚠ User.nickname (length): 0 tests ← Not tested!- Machine Learning Rule Inference - Suggest validation rules based on sample data
- Visual Rule Builder - GUI tool for building complex validation rules
- Real-time Validation Streaming - Stream validation results for large datasets
- Contract Testing Generator - Generate Pact/contract tests from validation rules
Interested in helping with any of these features?
- Check if an RFC exists for the feature
- If not, open an issue to discuss the design
- We'll create an RFC for major features
- Implementation PRs welcome after RFC approval
Maintainer: Dayna Blackwell (blackwellsystems@protonmail.com)