Class WhitelistRules

java.lang.Object
com.atlassian.oai.validator.whitelist.rule.WhitelistRules

public final class WhitelistRules extends Object
Static factory methods for creating WhitelistRule instances.
  • Method Details

    • allOf

      public static WhitelistRule allOf(WhitelistRule... rules)
      Creates a rule that matches if all given rules match.
    • anyOf

      public static WhitelistRule anyOf(WhitelistRule... rules)
      Creates a rule that matches if any of the given rules match.
    • entityIs

      public static WhitelistRule entityIs(String entityName)
      Matches if the given entity (identified by name) is sent in the request or returned in the response, as specified in the spec (actual json payload are not inspected).
    • messageHasKey

      public static WhitelistRule messageHasKey(String key)
      Matches all error messages with the given key.
    • messageContains

      @Deprecated public static WhitelistRule messageContains(String regexp)
      Matches messages that contain the given regular expression in their text.
    • messageContainsRegexp

      public static WhitelistRule messageContainsRegexp(String regexp)
      Matches validation messages that contain a substring that matches the given regular expression.
      Parameters:
      regexp - The regex to use to match within the validation message
    • messageContainsSubstring

      public static WhitelistRule messageContainsSubstring(String substring)
      Matches validation messages that contain a substring that matches the given regular expression.
      Parameters:
      substring - The substring to search for
    • pathContains

      @Deprecated public static WhitelistRule pathContains(String regexp)
      Matches operations that contain the given regular expression in their API path.

      The tested path does not have parameters materialized, but is taken from the API definition, e.g. "/store/order/{orderId}".

    • pathContainsRegexp

      public static WhitelistRule pathContainsRegexp(String regexp)
      Matches operations whose API path contains a substring that matches the given regular expression.

      The tested path does not have parameters materialized, but is taken from the API definition, e.g. "/store/order/{orderId}".

      Parameters:
      regexp - The regex to use to match within the API path
    • pathContainsSubstring

      public static WhitelistRule pathContainsSubstring(String substring)
      Matches operations whose API path contains a the given substring.

      The tested path does not have parameters materialized, but is taken from the API definition, e.g. "/store/order/{orderId}".

      Parameters:
      substring - The substring to search for
    • isRequest

      public static WhitelistRule isRequest()
      Matches all request errors.
    • isResponse

      public static WhitelistRule isResponse()
      Matches all response errors.
    • responseStatusIs

      public static WhitelistRule responseStatusIs(int status)
      Matches all responses with the given status.
    • responseStatusTypeIs

      public static WhitelistRule responseStatusTypeIs(StatusType statusType)
      Matches all responses with the given status type.
    • methodIs

      public static WhitelistRule methodIs(io.swagger.v3.oas.models.PathItem.HttpMethod method)
      Matches all operations with the given method. Both request and response errors can be matched with this.
    • headerContains

      @Deprecated public static WhitelistRule headerContains(String header, String regexp)
      Deprecated.
      Matches requests or responses whose at least one of the given header's values contain the given regular expression. Each header value is inspected separately, and the rule will match if any value matches the expression.
    • headerContainsRegexp

      public static WhitelistRule headerContainsRegexp(String header, String regexp)
      Matches requests or responses where the given regex matches a subsequence within at least one of the given header's values.

      Each header value is inspected separately, and the rule will match if any value matches on the expression.

      Parameters:
      header - The name of the header to match on
      regexp - The regex to use to search within the header value
    • headerContainsSubstring

      public static WhitelistRule headerContainsSubstring(String header, String substring)
      Matches requests or responses where at least one of the given header's values contains the given substring.

      Each header value is inspected separately, and the rule will match if any value matches on the expression.

      Parameters:
      header - The name of the header to match on
      substring - The substring to search for