ConstCreates a string schema builder.
String schema with validation methods
Creates a number schema builder.
Number schema with validation methods
import { t, schema } from 'kitojs';
const userSchema = schema({
params: t.object({
id: t.str().uuid()
}),
body: t.object({
name: t.str().min(1).max(50),
email: t.str().email(),
age: t.num().min(0).optional()
})
});
app.post('/users/:id', [userSchema], ctx => {
// ctx.req.params.id is validated as UUID
// ctx.req.body is type-safe and validated
});
Schema builder utilities for creating type-safe request validation schemas.