SimpleSchema is a mature, isomorphic JavaScript object validation library (v3.4.7, 2025) that validates and cleans objects, including MongoDB update modifier documents. Written in TypeScript with ESM and CJS support, it has been maintained for 10+ years, features nearly 500 tests, and is used by Mailchimp Open Commerce and Meteor packages. Key differentiators: direct validation of MongoDB update documents, automatic cleaning (type conversion, removal of unsupported properties), powerful customizable error messages with i18n support, and TypeScript types. Slower and more complex than alternatives like Joi or yup, but offers unique MongoDB modifiers support and a mature ecosystem.
npm install simpl-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows schema definition, validation (with throw and error collection), MongoDB update modifier validation, and automatic cleaning.
Always pass { modifier: true } to schema.validate() or schema.clean() when validating or cleaning MongoDB update modifier objects.Use schema.extend(subschema) instead of SimpleSchema.extend(subschema).
Always use 'new SimpleSchema(...)' to instantiate.
Update import/require statements to use 'simpl-schema'.
Use context.addInvalidError(...) or throw a validation error inside custom validation functions.
Ensure you use 'new SimpleSchema(...)' and import correctly: import SimpleSchema from 'simpl-schema'
Run 'npm install simpl-schema' and verify import: import SimpleSchema from 'simpl-schema'
Pass { modifier: true } to schema.validate() or schema.clean().Use schema.newContext() to get a context, then call context.validate(obj) to collect validation errors without throwing.
Schema must be instantiated with 'new SimpleSchema()' and then call schema.clean().