length


length will check that a value meets a minimum or a maximum length (or both).

How do I use this function?

This function is configured by the following functionOptions. Essentially min and max determine if those limits are checked.

NAME DESCRIPTION TYPE REQUIRED?
min The minimum floor you want to check for integer no
max The maximum ceiling you want to check for integer no

You need to set at least one of these properties.

Example ruleset configurations

check-the-length:
  description: "Check the length of 'name' is at least 5 characters long"
  type: style
  recommended: true
  given: $.tags[*]
  then:
    field: name
    function: "length"
    functionOptions:
      min: 5
check-the-range:
  description: "Check the 'name' is at least three and less than 10 chars long"
  type: style
  recommended: true
  given: $.tags[*]
  then:
    field: name
    function: "length"
    functionOptions:
      min: 5
      max: 10

View Spectral Equivalent


View Function Source