simpl-schema
Advanced tools
Comparing version 1.7.3 to 1.8.0
@@ -245,2 +245,3 @@ "use strict"; | ||
}, | ||
validationContext: validationContext, | ||
value: val | ||
@@ -247,0 +248,0 @@ }, extendedCustomContext || {}); // Perform validation for this key |
{ | ||
"name": "simpl-schema", | ||
"version": "1.7.3", | ||
"version": "1.8.0", | ||
"description": "A schema validation package that supports direct validation of MongoDB update modifier objects.", | ||
@@ -5,0 +5,0 @@ "author": "Eric Dobbertin <aldeed@gmail.com>", |
@@ -423,2 +423,32 @@ # SimpleSchema (simpl-schema NPM package) | ||
When one of the allowed types is an object, use a subschema. Don't mix the object property definitions in with the main schema. | ||
Correct: | ||
```js | ||
import SimpleSchema from 'simpl-schema'; | ||
const objSchema = new SimpleSchema({ | ||
_id: String | ||
}); | ||
const schema = new SimpleSchema({ | ||
foo: SimpleSchema.oneOf(String, objSchema) | ||
}); | ||
``` | ||
Incorrect: | ||
```js | ||
import SimpleSchema from 'simpl-schema'; | ||
const schema = new SimpleSchema({ | ||
foo: SimpleSchema.oneOf(String, Object), | ||
'foo._id': { | ||
type: String, | ||
optional: true | ||
} | ||
}); | ||
``` | ||
NOTE: Multiple definitions is still an experimental feature and may not work as you expect in complex situations, such as where one of the valid definitions is an object or array. By reporting any weirdness you experience, you can help make it more robust. | ||
@@ -799,2 +829,3 @@ | ||
- `this.siblingField()`: Use this method to get information about other fields that have the same parent object. Works the same way as `field()`. This is helpful when you use sub-schemas or when you're dealing with arrays of objects. | ||
- `this.validationContext`: The current validation context | ||
- `this.value`: If isSet = true, this contains the field's current (requested) value in the document or modifier. | ||
@@ -801,0 +832,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
198008
2882
1379
0