refactor: strictDefaults option
parent
e993bd6b4e
commit
38d1acddad
|
@ -1,13 +1,12 @@
|
|||
{{## def.assignDefault:
|
||||
{{? it.compositeRule }}
|
||||
{{? it.opts.strictDefaults }}
|
||||
{{ var $defaultMsg = 'default is ignored for: ' + $passData; }}
|
||||
{{? it.opts.strictDefaults === 'log' }}
|
||||
{{ it.logger.warn($defaultMsg); }}
|
||||
{{??}}
|
||||
{{ throw new Error($defaultMsg); }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{
|
||||
if (it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored for: ' + $passData;
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
if ({{=$passData}} === undefined
|
||||
{{? it.opts.useDefaults == 'empty' }}
|
||||
|
|
|
@ -82,15 +82,13 @@
|
|||
delete it.isTop;
|
||||
|
||||
it.dataPathArr = [undefined];
|
||||
|
||||
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored in the schema root';
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
}}
|
||||
{{? it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults }}
|
||||
{{ var $defaultMsg = 'default is ignored in the schema root'; }}
|
||||
{{? it.opts.strictDefaults === 'log' }}
|
||||
{{ it.logger.warn($defaultMsg); }}
|
||||
{{??}}
|
||||
{{ throw new Error($defaultMsg); }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
var vErrors = null; {{ /* don't edit, used in replace */ }}
|
||||
var errors = 0; {{ /* don't edit, used in replace */ }}
|
||||
|
|
Loading…
Reference in New Issue