Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
m2e-validator
Advanced tools
Readme
This package converts Mongoose schema into a validation chain for Express. Currently, it supports most default schema types as well as a few custom ones. For instance, schema types named Email or Phone match validator's implementation. See the full list of supported properties below.
This module works through a custom Mongoose plugin that appends two static methods, getSchemaPaths
and getChildPaths
. Both work recursively and support child and discriminator schemas. To access a discriminator, though, the request object must contain a reference to its key. See the examples below for more detail.
// coming soon
All schema types support required and systemOnly properties. The latter omits the field from validation altogether.
Name | Options | Notes |
---|---|---|
String | minLength, maxLength, enum | Auto escapes and trims |
Number | min, max | |
ObjectId | ||
SchemaArray | ||
Date | Auto converts to ISO string | |
Boolean | Auto converts any non-falsy value to true | |
URL | -- | Auto normalizes |
-- | Auto normalizes | |
Phone | -- |
FAQs
Convert mongoose schema into an express-validator chain
The npm package m2e-validator receives a total of 14 weekly downloads. As such, m2e-validator popularity was classified as not popular.
We found that m2e-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.