FAQ

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • ✨ New! Try the OpenAPI Doctor ✨ The OpenAPI Doctor

    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 TYPE REQUIRED? DESCRIPTION
    match string no If set, value must match the regex pattern
    notMatch string no If set, value must not match the regex pattern

    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