'use strict'; module.exports = function generate_allOf(it, $keyword, $ruleType) { var out = ' '; var $schema = it.schema[$keyword]; var $schemaPath = it.schemaPath + it.util.getProperty($keyword); var $errSchemaPath = it.errSchemaPath + '/' + $keyword; var $breakOnError = !it.opts.allErrors; var $it = it.util.copy(it); var $closingBraces = ''; $it.level++; var $nextValid = 'valid' + $it.level; var $currentBaseId = $it.baseId, $allSchemasEmpty = true; var arr1 = $schema; if (arr1) { var $sch, $i = -1, l1 = arr1.length - 1; while ($i < l1) { $sch = arr1[$i += 1]; if (it.util.schemaHasRules($sch, it.RULES.all)) { $allSchemasEmpty = false; $it.schema = $sch; $it.schemaPath = $schemaPath + '[' + $i + ']'; $it.errSchemaPath = $errSchemaPath + '/' + $i; out += ' ' + (it.validate($it)) + ' '; $it.baseId = $currentBaseId; if ($breakOnError) { out += ' if (' + ($nextValid) + ') { '; $closingBraces += '}'; } } } } if ($breakOnError) { if ($allSchemasEmpty) { out += ' if (true) { '; } else { out += ' ' + ($closingBraces.slice(0, -1)) + ' '; } } out = it.util.cleanUpCode(out); return out; }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
README.md | File | 149 B | 0644 |
|
_limit.js | File | 6.68 KB | 0644 |
|
_limitItems.js | File | 2.53 KB | 0644 |
|
_limitLength.js | File | 2.65 KB | 0644 |
|
_limitProperties.js | File | 2.57 KB | 0644 |
|
allOf.js | File | 1.25 KB | 0644 |
|
anyOf.js | File | 2.78 KB | 0644 |
|
const.js | File | 2.02 KB | 0644 |
|
contains.js | File | 3.21 KB | 0644 |
|
custom.js | File | 9.55 KB | 0644 |
|
dependencies.js | File | 7.42 KB | 0644 |
|
enum.js | File | 2.52 KB | 0644 |
|
format.js | File | 5.47 KB | 0644 |
|
items.js | File | 5.74 KB | 0644 |
|
multipleOf.js | File | 2.63 KB | 0644 |
|
not.js | File | 3.26 KB | 0644 |
|
oneOf.js | File | 2.74 KB | 0644 |
|
pattern.js | File | 2.52 KB | 0644 |
|
properties.js | File | 21.34 KB | 0644 |
|
propertyNames.js | File | 3.44 KB | 0644 |
|
ref.js | File | 4.57 KB | 0644 |
|
required.js | File | 11.96 KB | 0644 |
|
uniqueItems.js | File | 2.8 KB | 0644 |
|
validate.js | File | 18.04 KB | 0644 |
|