aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ajv/lib/dot/custom.jst
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/ajv/lib/dot/custom.jst
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
node_modules
Diffstat (limited to 'node_modules/ajv/lib/dot/custom.jst')
-rw-r--r--node_modules/ajv/lib/dot/custom.jst23
1 files changed, 15 insertions, 8 deletions
diff --git a/node_modules/ajv/lib/dot/custom.jst b/node_modules/ajv/lib/dot/custom.jst
index e91c50e6f..402028e6b 100644
--- a/node_modules/ajv/lib/dot/custom.jst
+++ b/node_modules/ajv/lib/dot/custom.jst
@@ -6,7 +6,8 @@
{{
var $rule = this
, $definition = 'definition' + $lvl
- , $rDef = $rule.definition;
+ , $rDef = $rule.definition
+ , $closingBraces = '';
var $validate = $rDef.validate;
var $compile, $inline, $macro, $ruleValidate, $validateCode;
}}
@@ -21,6 +22,7 @@
{{??}}
{{
$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
+ if (!$ruleValidate) return;
$schemaValue = 'validate.schema' + $schemaPath;
$validateCode = $ruleValidate.code;
$compile = $rDef.compile;
@@ -76,9 +78,16 @@ var {{=$valid}};
#}}
-{{? $validateSchema }}
- {{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}});
- if ({{=$valid}}) {
+{{? $isData && $rDef.$data }}
+ {{ $closingBraces += '}'; }}
+ if ({{=$schemaValue}} === undefined) {
+ {{=$valid}} = true;
+ } else {
+ {{? $validateSchema }}
+ {{ $closingBraces += '}'; }}
+ {{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}});
+ if ({{=$valid}}) {
+ {{?}}
{{?}}
{{? $inline }}
@@ -123,12 +132,10 @@ var {{=$valid}};
{{?}}
{{? $rDef.modifying }}
- {{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}];
+ if ({{=$parentData}}) {{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}];
{{?}}
-{{? $validateSchema }}
- }
-{{?}}
+{{= $closingBraces }}
{{## def.notValidationResult:
{{? $rDef.valid === undefined }}