-
Notifications
You must be signed in to change notification settings - Fork 0
Guide Validation
GitHub Actions edited this page Jan 25, 2026
·
2 revisions
Lerne, wie du Input Validation in VelinScript implementierst.
@POST("/api/users")
fn createUser(name: string, email: string): User {
let validator: Validator = Validator.new();
validator
.required("name", name)
.minLength("name", name, 3)
.maxLength("name", name, 50)
.email("email", email);
if (!validator.isValid()) {
let errors = validator.errors();
// Fehlerbehandlung
return User { id: "", name: "", email: "" };
}
// Validierung erfolgreich, weiter mit Logik
let user = User {
id: generateId(),
name: name,
email: email
};
return db.save(user);
}
@POST("/api/products")
fn createProduct(name: string, price: number, sku: string): Product {
let mut validator = Validator::new();
validator
.required("name", &name)
.min_length("name", &name, 3)
.max_length("name", &name, 100)
.required("sku", &sku)
.pattern("sku", &sku, "^[A-Z0-9-]+$", "SKU muss alphanumerisch sein");
if (!validator.is_valid()) {
let errors = validator.errors();
return HttpResponse::bad_request(
errors.map(|e| format!("{}: {}", e.field, e.message)).join(", ")
);
}
return db.save(Product { name, price, sku });
}
- Immer validieren für User-Input
- Klare Fehlermeldungen bereitstellen
- Konsistente Validierung über alle Endpoints
- Type Safety nutzen
- Tutorial 6: Authentication - JWT/OAuth2
- Tutorial 7: ML Integration - KI/ML Features
- Compiler Architecture
- Pass-Verlauf
- Type Inference
- Code Ordering
- IR Representation
- Borrow Checker
- Code Generation
- Multi-Target Compilation
- Module Resolution
- Framework Integration
- Parallelization
- AI Compiler Passes
- Prompt Optimizer
- System Generation
- Basics
- APIs
- Security
- Database
- Validation
- Authentication
- ML/LLM
- Intelligence Features
- Type Inference
- ML Training
- Pattern Matching
- Closures
- Collections
- HTTP Client
- String Interpolation
- Debugger
- Vektor-Datenbanken
- CLI Reference
- API Keys Setup
- Advanced
- Backend
- Security Best Practices
- AI/ML
- Auto Imports
- Plugin Development