"Fossies" - the Fresh Open Source Software Archive

Member "node-v12.18.4-win-x86/node_modules/npm/node_modules/ajv/lib/dot/errors.def" (14 Feb 2020, 8461 Bytes) of package /windows/www/node-v12.18.4-win-x86.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Modula2 source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 {{# def.definitions }}
    2 
    3 {{## def._error:_rule:
    4   {{ 'istanbul ignore else'; }}
    5   {{? it.createErrors !== false }}
    6     {
    7       keyword: '{{= $errorKeyword || _rule }}'
    8       , dataPath: (dataPath || '') + {{= it.errorPath }}
    9       , schemaPath: {{=it.util.toQuotedString($errSchemaPath)}}
   10       , params: {{# def._errorParams[_rule] }}
   11       {{? it.opts.messages !== false }}
   12         , message: {{# def._errorMessages[_rule] }}
   13       {{?}}
   14       {{? it.opts.verbose }}
   15         , schema: {{# def._errorSchemas[_rule] }}
   16         , parentSchema: validate.schema{{=it.schemaPath}}
   17         , data: {{=$data}}
   18       {{?}}
   19     }
   20   {{??}}
   21     {}
   22   {{?}}
   23 #}}
   24 
   25 
   26 {{## def._addError:_rule:
   27   if (vErrors === null) vErrors = [err];
   28   else vErrors.push(err);
   29   errors++;
   30 #}}
   31 
   32 
   33 {{## def.addError:_rule:
   34   var err = {{# def._error:_rule }};
   35   {{# def._addError:_rule }}
   36 #}}
   37 
   38 
   39 {{## def.error:_rule:
   40   {{# def.beginDefOut}}
   41     {{# def._error:_rule }}
   42   {{# def.storeDefOut:__err }}
   43 
   44   {{? !it.compositeRule && $breakOnError }}
   45     {{ 'istanbul ignore if'; }}
   46     {{? it.async }}
   47       throw new ValidationError([{{=__err}}]);
   48     {{??}}
   49       validate.errors = [{{=__err}}];
   50       return false;
   51     {{?}}
   52   {{??}}
   53     var err = {{=__err}};
   54     {{# def._addError:_rule }}
   55   {{?}}
   56 #}}
   57 
   58 
   59 {{## def.extraError:_rule:
   60   {{# def.addError:_rule}}
   61   {{? !it.compositeRule && $breakOnError }}
   62     {{ 'istanbul ignore if'; }}
   63     {{? it.async }}
   64       throw new ValidationError(vErrors);
   65     {{??}}
   66       validate.errors = vErrors;
   67       return false;
   68     {{?}}
   69   {{?}}
   70 #}}
   71 
   72 
   73 {{## def.checkError:_rule:
   74   if (!{{=$valid}}) {
   75     {{# def.error:_rule }}
   76   }
   77 #}}
   78 
   79 
   80 {{## def.resetErrors:
   81   errors = {{=$errs}};
   82   if (vErrors !== null) {
   83     if ({{=$errs}}) vErrors.length = {{=$errs}};
   84     else vErrors = null;
   85   }
   86 #}}
   87 
   88 
   89 {{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}}
   90 {{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}}
   91 {{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}}
   92 
   93 {{## def._errorMessages = {
   94   'false schema':  "'boolean schema is false'",
   95   $ref:            "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'",
   96   additionalItems: "'should NOT have more than {{=$schema.length}} items'",
   97   additionalProperties: "'should NOT have additional properties'",
   98   anyOf:           "'should match some schema in anyOf'",
   99   const:           "'should be equal to constant'",
  100   contains:        "'should contain a valid item'",
  101   dependencies:    "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'",
  102   'enum':          "'should be equal to one of the allowed values'",
  103   format:          "'should match format \"{{#def.concatSchemaEQ}}\"'",
  104   _limit:          "'should be {{=$opStr}} {{#def.appendSchema}}",
  105   _exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'",
  106   _limitItems:     "'should NOT have {{?$keyword=='maxItems'}}more{{??}}less{{?}} than {{#def.concatSchema}} items'",
  107   _limitLength:    "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'",
  108   _limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}less{{?}} than {{#def.concatSchema}} properties'",
  109   multipleOf:      "'should be multiple of {{#def.appendSchema}}",
  110   not:             "'should NOT be valid'",
  111   oneOf:           "'should match exactly one schema in oneOf'",
  112   pattern:         "'should match pattern \"{{#def.concatSchemaEQ}}\"'",
  113   patternGroups:   "'should NOT have {{=$moreOrLess}} than {{=$limit}} properties matching pattern \"{{=it.util.escapeQuotes($pgProperty)}}\"'",
  114   propertyNames:   "'property name \\'{{=$invalidName}}\\' is invalid'",
  115   required:        "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'",
  116   type:            "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'",
  117   uniqueItems:     "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'",
  118   custom:          "'should pass \"{{=$rule.keyword}}\" keyword validation'",
  119   patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''",
  120   switch:          "'should pass \"switch\" keyword validation'",
  121   _formatLimit:    "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'",
  122   _formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'"
  123 } #}}
  124 
  125 
  126 {{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}}
  127 {{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
  128 
  129 {{## def._errorSchemas = {
  130   'false schema':  "false",
  131   $ref:            "{{=it.util.toQuotedString($schema)}}",
  132   additionalItems: "false",
  133   additionalProperties: "false",
  134   anyOf:           "validate.schema{{=$schemaPath}}",
  135   const:           "validate.schema{{=$schemaPath}}",
  136   contains:        "validate.schema{{=$schemaPath}}",
  137   dependencies:    "validate.schema{{=$schemaPath}}",
  138   'enum':          "validate.schema{{=$schemaPath}}",
  139   format:          "{{#def.schemaRefOrQS}}",
  140   _limit:          "{{#def.schemaRefOrVal}}",
  141   _exclusiveLimit: "validate.schema{{=$schemaPath}}",
  142   _limitItems:     "{{#def.schemaRefOrVal}}",
  143   _limitLength:    "{{#def.schemaRefOrVal}}",
  144   _limitProperties:"{{#def.schemaRefOrVal}}",
  145   multipleOf:      "{{#def.schemaRefOrVal}}",
  146   not:             "validate.schema{{=$schemaPath}}",
  147   oneOf:           "validate.schema{{=$schemaPath}}",
  148   pattern:         "{{#def.schemaRefOrQS}}",
  149   patternGroups:   "validate.schema{{=$schemaPath}}",
  150   propertyNames:   "validate.schema{{=$schemaPath}}",
  151   required:        "validate.schema{{=$schemaPath}}",
  152   type:            "validate.schema{{=$schemaPath}}",
  153   uniqueItems:     "{{#def.schemaRefOrVal}}",
  154   custom:          "validate.schema{{=$schemaPath}}",
  155   patternRequired: "validate.schema{{=$schemaPath}}",
  156   switch:          "validate.schema{{=$schemaPath}}",
  157   _formatLimit:    "{{#def.schemaRefOrQS}}",
  158   _formatExclusiveLimit: "validate.schema{{=$schemaPath}}"
  159 } #}}
  160 
  161 
  162 {{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
  163 
  164 {{## def._errorParams = {
  165   'false schema':  "{}",
  166   $ref:            "{ ref: '{{=it.util.escapeQuotes($schema)}}' }",
  167   additionalItems: "{ limit: {{=$schema.length}} }",
  168   additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }",
  169   anyOf:           "{}",
  170   const:           "{}",
  171   contains:        "{}",
  172   dependencies:    "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }",
  173   'enum':          "{ allowedValues: schema{{=$lvl}} }",
  174   format:          "{ format: {{#def.schemaValueQS}} }",
  175   _limit:          "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }",
  176   _exclusiveLimit: "{}",
  177   _limitItems:     "{ limit: {{=$schemaValue}} }",
  178   _limitLength:    "{ limit: {{=$schemaValue}} }",
  179   _limitProperties:"{ limit: {{=$schemaValue}} }",
  180   multipleOf:      "{ multipleOf: {{=$schemaValue}} }",
  181   not:             "{}",
  182   oneOf:           "{}",
  183   pattern:         "{ pattern: {{#def.schemaValueQS}} }",
  184   patternGroups:   "{ reason: '{{=$reason}}', limit: {{=$limit}}, pattern: '{{=it.util.escapeQuotes($pgProperty)}}' }",
  185   propertyNames:   "{ propertyName: '{{=$invalidName}}' }",
  186   required:        "{ missingProperty: '{{=$missingProperty}}' }",
  187   type:            "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }",
  188   uniqueItems:     "{ i: i, j: j }",
  189   custom:          "{ keyword: '{{=$rule.keyword}}' }",
  190   patternRequired: "{ missingPattern: '{{=$missingPattern}}' }",
  191   switch:          "{ caseIndex: {{=$caseIndex}} }",
  192   _formatLimit:    "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }",
  193   _formatExclusiveLimit: "{}"
  194 } #}}