If validation fails, it throws an HTTP 422 error (Unprocessable Entity) with descriptive message, ex:
Expected a value of type string for title but received undefined.
intallation
npm install koa-superstruct
Install superstruct separately, allowing you to pass custom types and avoid peer dependency.
api
validate
validate(schema: Function) => Function
Accepts a Struct validator function. The top-level keys should map to koa's ctx.request object (ex. body, query, headers) and, failing that, to the ctx object (ex. ctx.params).