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 | TYPE | REQUIRED? | DESCRIPTION |
---|---|---|---|
keyedBy | string |
no | The key to for sorting object |
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