Opinionated input validation for Mali.js gRPC microservices using Ajv (version 0.4.0). Integrates Ajv JSON schema validation into Mali middleware, automatically validating request payloads against provided schemas. Updated infrequently; depends on @grpc/grpc-js ^1.3.6 and ajv ^8.6.2. Key differentiators: no manual validation calls, schema-first approach, standard gRPC error codes on failure.
npm install mali-ajvNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Import and apply Ajv validation schemas to Mali gRPC services.
Register addSchemas(app, schemas) as the first middleware before addService or use handlers.
Format: { ServiceName: { methodName: { type: 'object', ... } } }No fix needed, but document client-side handling of FAILED_PRECONDITION.
Consider using mali-onerror or custom validation middleware.
npm install mali-ajv
Use import { addSchemas } from 'mali-ajv'Ensure addSchemas is called with the Mali instance: addSchemas(app, schemas)