Class RequestValidator


  • public class RequestValidator
    extends Object
    Validate a request data against a given API operation defined in the OpenAPI Spec. The specific operation is looked up by API endpoint (path + httpMethod)
    Author:
    Steve Hu
    • Constructor Detail

      • RequestValidator

        public RequestValidator​(SchemaValidator schemaValidator)
        Construct a new request validator with the given schema validator.
        Parameters:
        schemaValidator - The schema validator to use when validating request bodies
    • Method Detail

      • validateRequest

        public com.networknt.status.Status validateRequest​(NormalisedPath requestPath,
                                                           io.undertow.server.HttpServerExchange exchange,
                                                           OpenApiOperation openApiOperation)
        Validate the request against the given API operation
        Parameters:
        requestPath - normalised path
        exchange - The HttpServerExchange to validate
        openApiOperation - OpenAPI operation
        Returns:
        A validation report containing validation errors