Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. 'use strict';
  2. // Load modules
  3. // Declare internals
  4. const internals = {};
  5. exports.errors = {
  6. root: 'value',
  7. key: '"{{!label}}" ',
  8. messages: {
  9. wrapArrays: true
  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. uri: 'must be a valid uri',
  134. uriRelativeOnly: 'must be a valid relative uri',
  135. uriCustomScheme: 'must be a valid uri with a scheme matching the {{scheme}} pattern',
  136. isoDate: 'must be a valid ISO 8601 date',
  137. guid: 'must be a valid GUID',
  138. hex: 'must only contain hexadecimal characters',
  139. base64: 'must be a valid base64 string',
  140. hostname: 'must be a valid hostname',
  141. normalize: 'must be unicode normalized in the {{form}} form',
  142. lowercase: 'must only contain lowercase characters',
  143. uppercase: 'must only contain uppercase characters',
  144. trim: 'must not have leading or trailing whitespace',
  145. creditCard: 'must be a credit card',
  146. ref: 'references "{{ref}}" which is not a number',
  147. ip: 'must be a valid ip address with a {{cidr}} CIDR',
  148. ipVersion: 'must be a valid ip address of one of the following versions {{version}} with a {{cidr}} CIDR'
  149. }
  150. };