Module: services/validators

This module contains commonly used validators.

Source:

Members

(static, constant) anyInteger :Joi

Joi validator that checks if a value is a number, an integer and the value must be present.

Type:
  • Joi
Source:

(static, constant) fileSize :Joi

Joi validator for a file size we are going to pass to bytes.parse see https://github.com/visionmedia/bytes.js#bytesparsestringnumber-value-numbernull

Type:
  • Joi
Source:

(static, constant) nonNegativeInteger :Joi

Joi validator that checks if a value is a number, an integer, greater than or equal to zero and the value must be present.

Type:
  • Joi
Source:

(static, constant) optionalDottedVersionNClausesWithOptionalSuffix :Joi

Joi validator that checks if a value is a string that matches a regular expression. The regular expression matches strings that start with one or more digits, followed by zero or more groups of a dot and one or more digits, followed by an optional suffix that starts with a dash or a plus sign and can contain any characters. This validator can be used to validate properties that can be version strings with an optional suffix or absent. For example, some valid values for this validator are: 1, 1.0, 1.0.0, 1.0.0-beta Some invalid values for this validator are: abc, 1.a, 1.0-, .1

Type:
  • Joi
Source:

(static, constant) optionalUrl :Joi

Joi validator that checks if a value is a URL

TODO: This accepts URLs with query strings and fragments, which for some purposes should be rejected.

Type:
  • Joi
Source:

(static, constant) relativeUri :Joi

Joi validator that checks if a value is a relative-only URI

Type:
  • Joi
Source:

(static, constant) semver :Joi

Joi validator that checks if a value is a valid semantic versioning string and the value must be present.

Type:
  • Joi
Source:

(static, constant) semverRange :Joi

Joi validator that checks if a value is a valid semantic versioning range and the value must be present.

Type:
  • Joi
Source:

(inner, constant) optionalNonNegativeInteger :Joi

Joi validator that checks if a value is a number, an integer, and greater than or equal to zero.

Type:
  • Joi
Source: