2015-06-03 03:36:59 +03:00
|
|
|
{{# def.definitions }}
|
|
|
|
{{# def.setup:'$ref' }}
|
|
|
|
|
2015-06-17 00:04:17 +03:00
|
|
|
{{## def.validateRef:_v:
|
|
|
|
if (!{{# def._validateRef:_v }}) {
|
2015-07-04 03:37:35 +03:00
|
|
|
if (vErrors === null) vErrors = {{=_v}}.errors;
|
|
|
|
else vErrors = vErrors.concat({{=_v}}.errors);
|
|
|
|
errors = vErrors.length;
|
2015-06-17 00:04:17 +03:00
|
|
|
} {{? $breakOnError }} else { {{?}}
|
|
|
|
#}}
|
|
|
|
|
2015-08-19 02:31:03 +03:00
|
|
|
{{## def._validateRef:_v: {{=_v}}({{=$data}}, (dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}) #}}
|
2015-06-17 00:04:17 +03:00
|
|
|
|
2015-06-06 21:44:07 +03:00
|
|
|
{{? $schema == '#' || $schema == '#/' }}
|
2015-06-16 17:10:21 +03:00
|
|
|
{{? it.isRoot }}
|
|
|
|
{{? $breakOnError && it.wasTop }}
|
2015-06-17 00:04:17 +03:00
|
|
|
if (!{{# def._validateRef:'validate' }})
|
2015-06-16 17:10:21 +03:00
|
|
|
return false;
|
|
|
|
else {
|
|
|
|
{{??}}
|
2015-07-04 03:37:35 +03:00
|
|
|
{{# def.validateRef:'validate' }}
|
2015-06-16 17:10:21 +03:00
|
|
|
{{?}}
|
2015-06-15 18:30:48 +03:00
|
|
|
{{??}}
|
2015-08-08 21:06:26 +03:00
|
|
|
{{# def.validateRef:'root.refVal[0]' }}
|
2015-06-15 18:30:48 +03:00
|
|
|
{{?}}
|
2015-05-31 20:39:12 +03:00
|
|
|
{{??}}
|
2015-08-08 14:21:41 +03:00
|
|
|
{{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }}
|
2015-06-16 17:10:21 +03:00
|
|
|
{{? $refVal === undefined }}
|
2015-06-18 16:59:11 +03:00
|
|
|
{{ var $message = 'can\'t resolve reference ' + $schema + ' from id ' + it.baseId; }}
|
2015-06-18 00:23:49 +03:00
|
|
|
{{? it.opts.missingRefs == 'fail' }}
|
|
|
|
{{ console.log($message); }}
|
|
|
|
{{# def.error:'$ref' }}
|
|
|
|
{{? $breakOnError }} if (false) { {{?}}
|
|
|
|
{{?? it.opts.missingRefs == 'ignore' }}
|
|
|
|
{{ console.log($message); }}
|
|
|
|
{{? $breakOnError }} if (true) { {{?}}
|
|
|
|
{{??}}
|
|
|
|
{{ throw new Error($message); }}
|
|
|
|
{{?}}
|
2015-08-20 00:54:05 +03:00
|
|
|
{{?? typeof $refVal == 'string' }}
|
2015-06-18 00:23:49 +03:00
|
|
|
{{# def.validateRef:$refVal }}
|
2015-08-20 00:54:05 +03:00
|
|
|
{{??}}
|
|
|
|
{{ /* console.log('inline: ', $refVal); */ }}
|
|
|
|
{{# def.setupNextLevel }}
|
|
|
|
{{
|
|
|
|
$it.schema = $refVal;
|
|
|
|
$it.schemaPath = '';
|
|
|
|
}}
|
|
|
|
{{= it.validate($it) }}
|
|
|
|
{{? $breakOnError}}
|
|
|
|
if (valid{{=$it.level}}) {
|
|
|
|
{{?}}
|
2015-06-06 18:18:52 +03:00
|
|
|
{{?}}
|
2015-05-31 20:39:12 +03:00
|
|
|
{{?}}
|