pattern


pattern is going to perform a regular expression check.

Supply a JSON Path and the regex that you want to match or notMatch.

vacuum uses Go RE2 Syntax for regular expressions.

How do I use this function?

pattern is configured by the following functionOptions

NAME DESCRIPTION TYPE REQUIRED?
match If set, value must match the regex pattern string no
notMatch If set, value must not match the regex pattern string no

Example ruleset configuration

oas2-host-trailing-slash:
  description: "Host URL should not contain a trailing slash"
  type: style
  recommended: true
  given: "$.host"
  then:
    function: "pattern"
    functionOptions:
      notMatch: "/$"

View Spectral Equivalent


View Function Source