Class WhitelistRules
java.lang.Object
com.atlassian.oai.validator.whitelist.rule.WhitelistRules
Static factory methods for creating
WhitelistRule instances.-
Method Summary
Modifier and TypeMethodDescriptionstatic WhitelistRuleallOf(WhitelistRule... rules) Creates a rule that matches if all given rules match.static WhitelistRuleanyOf(WhitelistRule... rules) Creates a rule that matches if any of the given rules match.static WhitelistRuleMatches 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).static WhitelistRuleheaderContains(String header, String regexp) Deprecated.static WhitelistRuleheaderContainsRegexp(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.static WhitelistRuleheaderContainsSubstring(String header, String substring) Matches requests or responses where at least one of the given header's values contains the given substring.static WhitelistRuleMatches all request errors.static WhitelistRuleMatches all response errors.static WhitelistRulemessageContains(String regexp) Deprecated.UsemessageContainsRegexp(java.lang.String)insteadstatic WhitelistRulemessageContainsRegexp(String regexp) Matches validation messages that contain a substring that matches the given regular expression.static WhitelistRulemessageContainsSubstring(String substring) Matches validation messages that contain a substring that matches the given regular expression.static WhitelistRulemessageHasKey(String key) Matches all error messages with the given key.static WhitelistRulemethodIs(io.swagger.v3.oas.models.PathItem.HttpMethod method) Matches all operations with the given method.static WhitelistRulepathContains(String regexp) Deprecated.UsepathContainsRegexp(String)orpathContainsSubstring(String)insteadstatic WhitelistRulepathContainsRegexp(String regexp) Matches operations whose API path contains a substring that matches the given regular expression.static WhitelistRulepathContainsSubstring(String substring) Matches operations whose API path contains a the given substring.static WhitelistRuleresponseStatusIs(int status) Matches all responses with the given status.static WhitelistRuleresponseStatusTypeIs(StatusType statusType) Matches all responses with the given status type.
-
Method Details
-
allOf
Creates a rule that matches if all given rules match. -
anyOf
Creates a rule that matches if any of the given rules match. -
entityIs
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
Matches all error messages with the given key. -
messageContains
Deprecated.UsemessageContainsRegexp(java.lang.String)insteadMatches messages that contain the given regular expression in their text. -
messageContainsRegexp
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
Matches validation messages that contain a substring that matches the given regular expression.- Parameters:
substring- The substring to search for
-
pathContains
Deprecated.UsepathContainsRegexp(String)orpathContainsSubstring(String)insteadMatches 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
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
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
Matches all request errors. -
isResponse
Matches all response errors. -
responseStatusIs
Matches all responses with the given status. -
responseStatusTypeIs
Matches all responses with the given status type. -
methodIs
Matches all operations with the given method. Both request and response errors can be matched with this. -
headerContains
Deprecated.UseheaderContainsRegexp(String, String)insteadMatches 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
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 onregexp- The regex to use to search within the header value
-
headerContainsSubstring
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 onsubstring- The substring to search for
-
headerContainsRegexp(String, String)instead