main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 | module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
---|
| 3 | var out = ' ';
|
---|
| 4 | var $schema = it.schema[$keyword];
|
---|
| 5 | var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
---|
| 6 | var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
---|
| 7 | var $breakOnError = !it.opts.allErrors;
|
---|
| 8 | var $it = it.util.copy(it);
|
---|
| 9 | var $closingBraces = '';
|
---|
| 10 | $it.level++;
|
---|
| 11 | var $nextValid = 'valid' + $it.level;
|
---|
| 12 | var $currentBaseId = $it.baseId,
|
---|
| 13 | $allSchemasEmpty = true;
|
---|
| 14 | var arr1 = $schema;
|
---|
| 15 | if (arr1) {
|
---|
| 16 | var $sch, $i = -1,
|
---|
| 17 | l1 = arr1.length - 1;
|
---|
| 18 | while ($i < l1) {
|
---|
| 19 | $sch = arr1[$i += 1];
|
---|
| 20 | if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
---|
| 21 | $allSchemasEmpty = false;
|
---|
| 22 | $it.schema = $sch;
|
---|
| 23 | $it.schemaPath = $schemaPath + '[' + $i + ']';
|
---|
| 24 | $it.errSchemaPath = $errSchemaPath + '/' + $i;
|
---|
| 25 | out += ' ' + (it.validate($it)) + ' ';
|
---|
| 26 | $it.baseId = $currentBaseId;
|
---|
| 27 | if ($breakOnError) {
|
---|
| 28 | out += ' if (' + ($nextValid) + ') { ';
|
---|
| 29 | $closingBraces += '}';
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 | }
|
---|
| 34 | if ($breakOnError) {
|
---|
| 35 | if ($allSchemasEmpty) {
|
---|
| 36 | out += ' if (true) { ';
|
---|
| 37 | } else {
|
---|
| 38 | out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 | return out;
|
---|
| 42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.