casing
casing will check that a value is using the correct case
.
How do I use this function?
This function is configured by the following functionOptions
. Essentially the type
is the case you want
to check for.
NAME | TYPE | REQUIRED? | DESCRIPTION |
---|---|---|---|
type | string |
yes | The case you want to check |
disallowDigits | boolean |
false | Don’t allow any digits in pattern |
separator.char | string |
false | Use a separator character |
separator.allowLeading | boolean |
false | llow a leading separator or not |
type
can be one of the following:
- flat
- camel
- pascal
- kebab
- cobol
- snake
- macro
Example ruleset configurations
check-the-case:
description: "Check the case of the name is camelCase"
type: style
recommended: true
given: $.tags[*]
then:
field: name
function: "casing"
functionOptions:
type: camel
check-the-case-noDigits:
description: "Check the case of the name is PascalCase and has no digits"
type: style
recommended: true
given: $.tags[*]
then:
field: name
function: "casing"
functionOptions:
type: pascal
disallowDigits: true