alphabetical


alphabetical will check that a given array via a JSON Path is ordered alphabetically.

The value should not be false or an empty string "" or null

How do I use this function?

This function is configured by the following functionOptions. Essentially the keyedBy value is the property of the object, that is to be checked for alphabetic ordering.

NAME DESCRIPTION TYPE REQUIRED?
keyedBy the key to for sorting objects string no

Example ruleset configuration

openapi-tags-alphabetical:
  description: "Tags should be in alphabetical order."
  type: style
  recommended: false
  given: $.tags
  then:
    field: tags
    function: alphabetical
    functionOptions:
      keyedBy: name

View Spectral Equivalent


View Function Source