Interface RequestValidatorOptions

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
RequestValidatorProps
All Known Implementing Classes:
RequestValidatorOptions.Jsii$Proxy, RequestValidatorProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.99.0 (build 8f757e4)", date="2024-06-13T18:49:13.761Z") @Stability(Stable) public interface RequestValidatorOptions extends software.amazon.jsii.JsiiSerializable
Example:

 LambdaIntegration integration;
 Resource resource;
 Model responseModel;
 Model errorResponseModel;
 resource.addMethod("GET", integration, MethodOptions.builder()
         // We can mark the parameters as required
         .requestParameters(Map.of(
                 "method.request.querystring.who", true))
         // we can set request validator options like below
         .requestValidatorOptions(RequestValidatorOptions.builder()
                 .requestValidatorName("test-validator")
                 .validateRequestBody(true)
                 .validateRequestParameters(false)
                 .build())
         .methodResponses(List.of(MethodResponse.builder()
                 // Successful response from the integration
                 .statusCode("200")
                 // Define what parameters are allowed or not
                 .responseParameters(Map.of(
                         "method.response.header.Content-Type", true,
                         "method.response.header.Access-Control-Allow-Origin", true,
                         "method.response.header.Access-Control-Allow-Credentials", true))
                 // Validate the schema on the response
                 .responseModels(Map.of(
                         "application/json", responseModel))
                 .build(), MethodResponse.builder()
                 // Same thing for the error responses
                 .statusCode("400")
                 .responseParameters(Map.of(
                         "method.response.header.Content-Type", true,
                         "method.response.header.Access-Control-Allow-Origin", true,
                         "method.response.header.Access-Control-Allow-Credentials", true))
                 .responseModels(Map.of(
                         "application/json", errorResponseModel))
                 .build()))
         .build());
 
  • Method Details

    • getRequestValidatorName

      @Stability(Stable) @Nullable default String getRequestValidatorName()
      The name of this request validator.

      Default: None

    • getValidateRequestBody

      @Stability(Stable) @Nullable default Boolean getValidateRequestBody()
      Indicates whether to validate the request body according to the configured schema for the targeted API and method.

      Default: false

    • getValidateRequestParameters

      @Stability(Stable) @Nullable default Boolean getValidateRequestParameters()
      Indicates whether to validate request parameters.

      Default: false

    • builder

      @Stability(Stable) static RequestValidatorOptions.Builder builder()
      Returns:
      a RequestValidatorOptions.Builder of RequestValidatorOptions