Skip to content
v2.278.0

RequestValidatorProps Struct ​

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigateway as apigateway } from 'aws-cdk-lib';

declare const restApi: apigateway.RestApi;
const requestValidatorProps: apigateway.RequestValidatorProps = {
  restApi: restApi,

  // the properties below are optional
  requestValidatorName: 'requestValidatorName',
  validateRequestBody: false,
  validateRequestParameters: false,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigateway as apigateway

# rest_api: apigateway.RestApi

request_validator_props = apigateway.RequestValidatorProps(
    rest_api=rest_api,

    # the properties below are optional
    request_validator_name="requestValidatorName",
    validate_request_body=False,
    validate_request_parameters=False
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigateway.*;

RestApi restApi;

RequestValidatorProps requestValidatorProps = RequestValidatorProps.builder()
        .restApi(restApi)

        // the properties below are optional
        .requestValidatorName("requestValidatorName")
        .validateRequestBody(false)
        .validateRequestParameters(false)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.APIGateway;

RestApi restApi;

var requestValidatorProps = new RequestValidatorProps {
    RestApi = restApi,

    // the properties below are optional
    RequestValidatorName = "requestValidatorName",
    ValidateRequestBody = false,
    ValidateRequestParameters = false
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var restApi RestApi

requestValidatorProps := &RequestValidatorProps{
	RestApi: restApi,

	// the properties below are optional
	RequestValidatorName: jsii.String("requestValidatorName"),
	ValidateRequestBody: jsii.Boolean(false),
	ValidateRequestParameters: jsii.Boolean(false),
}

Properties ​

requestValidatorNameoptionalstringrequest_validator_nameoptionalstrrequestValidatorNameoptionalStringRequestValidatorNameoptionalstringRequestValidatorNameoptional*string = None #
The name of this request validator.
restApiIRestApirest_apiIRestApirestApiIRestApiRestApiIRestApiRestApiIRestApi required #
The rest API that this model is part of.
notes

The reason we need the RestApi object itself and not just the ID is because the model is being tracked by the top-level RestApi object for the purpose of calculating its hash to determine the ID of the deployment. This allows us to automatically update the deployment when the model of the REST API changes.

validateRequestBodyoptionalbooleanvalidate_request_bodyoptionalboolvalidateRequestBodyoptionalBooleanValidateRequestBodyoptionalboolValidateRequestBodyoptional*bool = false #
Indicates whether to validate the request body according to the configured schema for the targeted API and method.
validateRequestParametersoptionalbooleanvalidate_request_parametersoptionalboolvalidateRequestParametersoptionalBooleanValidateRequestParametersoptionalboolValidateRequestParametersoptional*bool = false #
Indicates whether to validate request parameters.