PHP 8.2.30
Preview: required.jst Size: 2.80 KB
/proc/self/root/opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules/ajv/lib/dot/required.jst

{{# def.definitions }}
{{# def.errors }}
{{# def.missing }}
{{# def.setupKeyword }}
{{# def.$data }}

{{ var $vSchema = 'schema' + $lvl; }}

{{## def.setupLoop:
  {{? !$isData }}
    var {{=$vSchema}} = validate.schema{{=$schemaPath}};
  {{?}}

  {{
    var $i = 'i' + $lvl
      , $propertyPath = 'schema' + $lvl + '[' + $i + ']'
      , $missingProperty = '\' + ' + $propertyPath + ' + \'';
    if (it.opts._errorDataPathProperty) {
      it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
    }
  }}
#}}


{{## def.isRequiredOwnProperty:
  Object.prototype.hasOwnProperty.call({{=$data}}, {{=$vSchema}}[{{=$i}}])
#}}


{{? !$isData }}
  {{? $schema.length < it.opts.loopRequired &&
      it.schema.properties && Object.keys(it.schema.properties).length }}
    {{ var $required = []; }}
    {{~ $schema:$property }}
      {{ var $propertySch = it.schema.properties[$property]; }}
      {{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }}
        {{ $required[$required.length] = $property; }}
      {{?}}
    {{~}}
  {{??}}
    {{ var $required = $schema; }}
  {{?}}
{{?}}


{{? $isData || $required.length }}
  {{
    var $currentErrorPath = it.errorPath
      , $loopRequired = $isData || $required.length >= it.opts.loopRequired
      , $ownProperties = it.opts.ownProperties;
  }}

  {{? $breakOnError }}
    var missing{{=$lvl}};
    {{? $loopRequired }}
      {{# def.setupLoop }}
      var {{=$valid}} = true;

      {{?$isData}}{{# def.check$dataIsArray }}{{?}}

      for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
        {{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined
                      {{? $ownProperties }}
                        && {{# def.isRequiredOwnProperty }}
                      {{?}};
        if (!{{=$valid}}) break;
      }

      {{? $isData }}  }  {{?}}

      {{# def.checkError:'required' }}
      else {
    {{??}}
      if ({{# def.checkMissingProperty:$required }}) {
        {{# def.errorMissingProperty:'required' }}
      } else {
    {{?}}
  {{??}}
    {{? $loopRequired }}
      {{# def.setupLoop }}
      {{? $isData }}
        if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) {
          {{# def.addError:'required' }}
        } else if ({{=$vSchema}} !== undefined) {
      {{?}}

      for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
        if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined
            {{? $ownProperties }}
              || !{{# def.isRequiredOwnProperty }}
            {{?}}) {
          {{# def.addError:'required' }}
        }
      }

      {{? $isData }}  }  {{?}}
    {{??}}
      {{~ $required:$propertyKey }}
        {{# def.allErrorsMissingProperty:'required' }}
      {{~}}
    {{?}}
  {{?}}

  {{ it.errorPath = $currentErrorPath; }}

{{?? $breakOnError }}
  if (true) {
{{?}}

Directory Contents

Dirs: 0 × Files: 28

Name Size Perms Modified Actions
629 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
943 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
2.17 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
280 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
1.18 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
4.85 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
859 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
3.80 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
1.80 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
552 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
8.07 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
3.09 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
2.57 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
1.17 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
618 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
861 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
922 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
348 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
10.08 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
1.28 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
2.37 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
2.80 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
837 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
7.06 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
3.25 KB lrw-r--r-- 2021-09-28 10:29:28
Edit Download
327 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
332 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download
350 B lrw-r--r-- 2021-09-28 10:29:28
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).