src/helpers/i18n/locales/en-US/validation.js   A
last analyzed

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 151
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 0
c 1
b 0
f 0
nc 1
mnd 0
bc 0
fnc 0
dl 0
loc 151
rs 10
bpm 0
cpm 0
noi 0
1
'use strict'
2
// https://github.com/hapijs/joi/blob/v13.0.2/lib/language.js
3
module.exports = {
4
  root: 'value',
5
  key: '"{{!label}}" ',
6
  messages: {
7
    wrapArrays: true,
8
    errors: 'Validation failed: {{limit}} error(s) found',
9
    password_confirmation: 'must match the informated password'
10
  },
11
  any: {
12
    unknown: 'is not allowed',
13
    invalid: 'contains an invalid value',
14
    empty: 'is not allowed to be empty',
15
    required: 'is required',
16
    allowOnly: 'must be one of {{valids}}',
17
    default: 'threw an error when running default method'
18
  },
19
  alternatives: {
20
    base: 'not matching any of the allowed alternatives',
21
    child: null
22
  },
23
  array: {
24
    base: 'must be an array',
25
    includes: 'at position {{pos}} does not match any of the allowed types',
26
    includesSingle: 'single value of "{{!label}}" does not match any of the allowed types',
27
    includesOne: 'at position {{pos}} fails because {{reason}}',
28
    includesOneSingle: 'single value of "{{!label}}" fails because {{reason}}',
29
    includesRequiredUnknowns: 'does not contain {{unknownMisses}} required value(s)',
30
    includesRequiredKnowns: 'does not contain {{knownMisses}}',
31
    includesRequiredBoth: 'does not contain {{knownMisses}} and {{unknownMisses}} other required value(s)',
32
    excludes: 'at position {{pos}} contains an excluded value',
33
    excludesSingle: 'single value of "{{!label}}" contains an excluded value',
34
    min: 'must contain at least {{limit}} items',
35
    max: 'must contain less than or equal to {{limit}} items',
36
    length: 'must contain {{limit}} items',
37
    ordered: 'at position {{pos}} fails because {{reason}}',
38
    orderedLength: 'at position {{pos}} fails because array must contain at most {{limit}} items',
39
    ref: 'references "{{ref}}" which is not a positive integer',
40
    sparse: 'must not be a sparse array',
41
    unique: 'position {{pos}} contains a duplicate value'
42
  },
43
  boolean: {
44
    base: 'must be a boolean'
45
  },
46
  binary: {
47
    base: 'must be a buffer or a string',
48
    min: 'must be at least {{limit}} bytes',
49
    max: 'must be less than or equal to {{limit}} bytes',
50
    length: 'must be {{limit}} bytes'
51
  },
52
  date: {
53
    base: 'must be a number of milliseconds or valid date string',
54
    format: 'must be a string with one of the following formats {{format}}',
55
    strict: 'must be a valid date',
56
    min: 'must be larger than or equal to "{{limit}}"',
57
    max: 'must be less than or equal to "{{limit}}"',
58
    isoDate: 'must be a valid ISO 8601 date',
59
    timestamp: {
60
      javascript: 'must be a valid timestamp or number of milliseconds',
61
      unix: 'must be a valid timestamp or number of seconds'
62
    },
63
    ref: 'references "{{ref}}" which is not a date'
64
  },
65
  function: {
66
    base: 'must be a Function',
67
    arity: 'must have an arity of {{n}}',
68
    minArity: 'must have an arity greater or equal to {{n}}',
69
    maxArity: 'must have an arity lesser or equal to {{n}}',
70
    ref: 'must be a Joi reference',
71
    class: 'must be a class'
72
  },
73
  lazy: {
74
    base: '!!schema error: lazy schema must be set',
75
    schema: '!!schema error: lazy schema function must return a schema'
76
  },
77
  object: {
78
    base: 'must be an object',
79
    child: '!!child "{{!child}}" fails because {{reason}}',
80
    min: 'must have at least {{limit}} children',
81
    max: 'must have less than or equal to {{limit}} children',
82
    length: 'must have {{limit}} children',
83
    allowUnknown: '!!"{{!child}}" is not allowed',
84
    with: '!!"{{mainWithLabel}}" missing required peer "{{peerWithLabel}}"',
85
    without: '!!"{{mainWithLabel}}" conflict with forbidden peer "{{peerWithLabel}}"',
86
    missing: 'must contain at least one of {{peersWithLabels}}',
87
    xor: 'contains a conflict between exclusive peers {{peersWithLabels}}',
88
    or: 'must contain at least one of {{peersWithLabels}}',
89
    and: 'contains {{presentWithLabels}} without its required peers {{missingWithLabels}}',
90
    nand: '!!"{{mainWithLabel}}" must not exist simultaneously with {{peersWithLabels}}',
91
    assert: '!!"{{ref}}" validation failed because "{{ref}}" failed to {{message}}',
92
    rename: {
93
      multiple: 'cannot rename child "{{from}}" because multiple renames are disabled and another key was already renamed to "{{to}}"',
94
      override: 'cannot rename child "{{from}}" because override is disabled and target "{{to}}" exists',
95
      regex: {
96
        multiple: 'cannot rename children {{from}} because multiple renames are disabled and another key was already renamed to "{{to}}"',
97
        override: 'cannot rename children {{from}} because override is disabled and target "{{to}}" exists'
98
      }
99
    },
100
    type: 'must be an instance of "{{type}}"',
101
    schema: 'must be a Joi instance'
102
  },
103
  number: {
104
    base: 'must be a number',
105
    min: 'must be larger than or equal to {{limit}}',
106
    max: 'must be less than or equal to {{limit}}',
107
    less: 'must be less than {{limit}}',
108
    greater: 'must be greater than {{limit}}',
109
    float: 'must be a float or double',
110
    integer: 'must be an integer',
111
    negative: 'must be a negative number',
112
    positive: 'must be a positive number',
113
    precision: 'must have no more than {{limit}} decimal places',
114
    ref: 'references "{{ref}}" which is not a number',
115
    multiple: 'must be a multiple of {{multiple}}'
116
  },
117
  string: {
118
    base: 'must be a string',
119
    min: 'length must be at least {{limit}} characters long',
120
    max: 'length must be less than or equal to {{limit}} characters long',
121
    length: 'length must be {{limit}} characters long',
122
    alphanum: 'must only contain alpha-numeric characters',
123
    token: 'must only contain alpha-numeric and underscore characters',
124
    regex: {
125
      base: 'with value "{{!value}}" fails to match the required pattern: {{pattern}}',
126
      name: 'with value "{{!value}}" fails to match the {{name}} pattern',
127
      invert: {
128
        base: 'with value "{{!value}}" matches the inverted pattern: {{pattern}}',
129
        name: 'with value "{{!value}}" matches the inverted {{name}} pattern'
130
      }
131
    },
132
    email: 'must be a valid email',
133
    emailExists: '"{{email}}" already exists',
134
    uri: 'must be a valid uri',
135
    uriRelativeOnly: 'must be a valid relative uri',
136
    uriCustomScheme: 'must be a valid uri with a scheme matching the {{scheme}} pattern',
137
    isoDate: 'must be a valid ISO 8601 date',
138
    guid: 'must be a valid GUID',
139
    hex: 'must only contain hexadecimal characters',
140
    base64: 'must be a valid base64 string',
141
    hostname: 'must be a valid hostname',
142
    normalize: 'must be unicode normalized in the {{form}} form',
143
    lowercase: 'must only contain lowercase characters',
144
    uppercase: 'must only contain uppercase characters',
145
    trim: 'must not have leading or trailing whitespace',
146
    creditCard: 'must be a credit card',
147
    ref: 'references "{{ref}}" which is not a number',
148
    ip: 'must be a valid ip address with a {{cidr}} CIDR',
149
    ipVersion: 'must be a valid ip address of one of the following versions {{version}} with a {{cidr}} CIDR'
150
  }
151
}
152