Schema Validation
AJV-based JSON Schema per route. Directions: request validation (sanitize/reject malformed inputs) and response validation (enforce structured-output schemas on LLM completions — for example, JSON-mode outputs that must match a published Order schema). Modes:
reject— non-compliant outputs return502and never reach the clientwarn— log violation, pass throughtransform— coerce to schema where possible
Any non-compliant LLM output can also be re-prompted through the enrichment pipeline (Section 26) — the original prompt is re-sent with an inline “previous response did not match schema X” hint, ensuring only valid data reaches the application. APIs: CRUD, validate, violations, stats.