Skip to content

Commit 7c9eb3c

Browse files
Freezystemvkarpov15
authored andcommitted
Add fullPath to ValidatorProps
1 parent 6586bf2 commit 7c9eb3c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/schematype.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,7 @@ SchemaType.prototype.doValidate = function(value, fn, scope, options) {
12871287

12881288
const validatorProperties = isSimpleValidator(v) ? Object.assign({}, v) : utils.clone(v);
12891289
validatorProperties.path = options && options.path ? options.path : path;
1290+
validatorProperties.fullPath = this.$fullPath;
12901291
validatorProperties.value = value;
12911292

12921293
if (validator instanceof RegExp) {
@@ -1408,6 +1409,7 @@ SchemaType.prototype.doValidateSync = function(value, scope, options) {
14081409
const validator = v.validator;
14091410
const validatorProperties = isSimpleValidator(v) ? Object.assign({}, v) : utils.clone(v);
14101411
validatorProperties.path = options && options.path ? options.path : path;
1412+
validatorProperties.fullPath = this.$fullPath;
14111413
validatorProperties.value = value;
14121414
let ok = false;
14131415

types/validation.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ declare module 'mongoose' {
44

55
interface ValidatorProps {
66
path: string;
7+
fullPath: string;
78
value: any;
89
}
910

0 commit comments

Comments
 (0)