Middy middleware that validates events, contexts, or responses using any Standard Schema-compatible validation library (Zod, Arktype, Valibot, Joi, Yup, etc.). Version 1.0.0 is stable, with active development. It intelligently merges validated types into the event TypeScript type and provides opt-in detailed error exposure. Supports all modern Middy core versions (4-7) and dual CJS/ESM module output. Differentiators: library-agnostic via Standard Schema spec, optional event transformation, and flexible error handling.
npm install middy-standard-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Validates event body using Zod schema with middy-standard-schema, using @middy/core and error handler.
Set { transform: false } in options to disable event transformation.Use dynamic import or switch to ESM: import { standardSchemaValidator } from 'middy-standard-schema'.Update @middy/core to version ^4.0.0 or later.
Use custom error handler instead of exposing errors to end users in production.
npm install middy-standard-schema @middy/core && set moduleResolution to 'node16' in tsconfig.json.
Change to dynamic import() or switch to ESM: use 'type': 'module' in package.json.
Install @middy/core >=4.0.0 and ensure it is imported correctly: import middy from '@middy/core'.