public class OpenApiMatchers extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
OpenApiMatchers.OpenApiValidationException |
| Constructor and Description |
|---|
OpenApiMatchers() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.test.web.servlet.ResultMatcher |
isValid(OpenApiInteractionValidator validator)
Assert the result can be validated using the given pre-configured validator.
|
org.springframework.test.web.servlet.ResultMatcher |
isValid(String specUrlOrPayload)
Assert the result can be validated against the given Swagger v2 or OpenAPI v3 specification.
|
public org.springframework.test.web.servlet.ResultMatcher isValid(String specUrlOrPayload)
The specification can be provided as a URL or an inline spec in JSON or YAML format.
A URL can be an absolute HTTP/HTTPS URL, a File URL or a classpath location (without the classpath: scheme).
For example:
// Create from a publicly hosted HTTP location
.isValid("http://api.myservice.com/swagger.json")
// Create from a file on the local filesystem
.isValid("file://Users/myuser/tmp/api.yaml");
// Create from a classpath resource in the /api package
.isValid("/api/swagger.json");
// Create from a swagger JSON payload
.isValid("{\"swagger\": \"2.0\", ...}")
specUrlOrPayload - The location of the Swagger JSON specification to use in the validator.public org.springframework.test.web.servlet.ResultMatcher isValid(OpenApiInteractionValidator validator)
validator - The pre-configured validator to useCopyright © 2016–2020 Atlassian. All rights reserved.