Package com.networknt.openapi
Class ResponseValidator
- java.lang.Object
-
- com.networknt.openapi.ResponseValidator
-
public class ResponseValidator extends Object
-
-
Constructor Summary
Constructors Constructor Description ResponseValidator()ResponseValidator(com.networknt.schema.SchemaValidatorsConfig config)Construct a new request validator with the given schema validator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.networknt.status.StatusvalidateResponse(io.undertow.server.HttpServerExchange exchange, OpenApiOperation openApiOperation)com.networknt.status.StatusvalidateResponseContent(Object responseContent, OpenApiOperation openApiOperation, String statusCode, String mediaTypeName)validate a given response content objectcom.networknt.status.StatusvalidateResponseContent(Object responseContent, io.undertow.server.HttpServerExchange exchange)validate a given response content object with status code "200" and media content type "application/json" uri, httpMethod, JSON_MEDIA_TYPE("200"), DEFAULT_MEDIA_TYPE("application/json") is to locate the schema to validatecom.networknt.status.StatusvalidateResponseContent(Object responseContent, String uri, String httpMethod)validate a given response content object with status code "200" and media content type "application/json" uri, httpMethod, JSON_MEDIA_TYPE("200"), DEFAULT_MEDIA_TYPE("application/json") is to locate the schema to validatecom.networknt.status.StatusvalidateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode)validate a given response content object with media content type "application/json" uri, httpMethod, statusCode, DEFAULT_MEDIA_TYPE is to locate the schema to validatecom.networknt.status.StatusvalidateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode, String mediaTypeName)validate a given response content object with schema coordinate (uri, httpMethod, statusCode, mediaTypeName) uri, httpMethod, statusCode, mediaTypeName is to locate the schema to validate
-
-
-
Method Detail
-
validateResponseContent
public com.networknt.status.Status validateResponseContent(Object responseContent, io.undertow.server.HttpServerExchange exchange)
validate a given response content object with status code "200" and media content type "application/json" uri, httpMethod, JSON_MEDIA_TYPE("200"), DEFAULT_MEDIA_TYPE("application/json") is to locate the schema to validate- Parameters:
responseContent- response content needs to be validatedexchange- HttpServerExchange in handler- Returns:
- Status return null if no validation errors
-
validateResponseContent
public com.networknt.status.Status validateResponseContent(Object responseContent, String uri, String httpMethod)
validate a given response content object with status code "200" and media content type "application/json" uri, httpMethod, JSON_MEDIA_TYPE("200"), DEFAULT_MEDIA_TYPE("application/json") is to locate the schema to validate- Parameters:
responseContent- response content needs to be validateduri- original uri of the requesthttpMethod- eg. "put" or "get"- Returns:
- Status return null if no validation errors
-
validateResponseContent
public com.networknt.status.Status validateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode)
validate a given response content object with media content type "application/json" uri, httpMethod, statusCode, DEFAULT_MEDIA_TYPE is to locate the schema to validate- Parameters:
responseContent- response content needs to be validateduri- original uri of the requesthttpMethod- eg. "put" or "get"statusCode- eg. 200, 400- Returns:
- Status return null if no validation errors
-
validateResponseContent
public com.networknt.status.Status validateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode, String mediaTypeName)
validate a given response content object with schema coordinate (uri, httpMethod, statusCode, mediaTypeName) uri, httpMethod, statusCode, mediaTypeName is to locate the schema to validate- Parameters:
responseContent- response content needs to be validateduri- original uri of the requesthttpMethod- eg. "put" or "get"statusCode- eg. 200, 400mediaTypeName- eg. "application/json"- Returns:
- Status return null if no validation errors
-
validateResponseContent
public com.networknt.status.Status validateResponseContent(Object responseContent, OpenApiOperation openApiOperation, String statusCode, String mediaTypeName)
validate a given response content object- Parameters:
responseContent- response content needs to be validatedopenApiOperation- OpenApi Operation which is located by uri and httpMethodstatusCode- eg. 200, 400mediaTypeName- eg. "application/json"- Returns:
- Status return null if no validation errors
-
validateResponse
public com.networknt.status.Status validateResponse(io.undertow.server.HttpServerExchange exchange, OpenApiOperation openApiOperation)
-
-