Schema Validation
Coming soon
This page is a placeholder while the full guide is written. See the @mqttkit/core README — Schema Validation for current reference material.
topic({ schema }) accepts any Standard Schema v1 validator: zod ≥3.24, valibot ≥1, arktype, and others. The validated payload is exposed on ctx.body with full type inference. The validate option controls direction ('inbound' | 'outbound' | 'both' | false).
Related packages
@mqttkit/typebox— register once withapp.addSchemaProvider(typeboxProvider)and pass rawType.X(...)schemas directly. TypeBox schemas are JSON Schema natively, so@mqttkit/asyncapiemits the full payload automatically.@mqttkit/zod—jsonify(schema)attaches a JSON Schema representation to a zod schema so@mqttkit/asyncapican emit the full payload (zod 3.x already speaks Standard Schema for runtime validation).
Examples
See examples/schema-validation for zod, typebox, coexist, and manual variants.