examples
examples copied to clipboard
Request Parameters aren't checked by API Gateway
Hi guys,
I tried to use the following syntax to enforce parameter check by the api gateway to not check it in the code:
https://www.serverless.com/framework/docs/providers/aws/events/apigateway/#request-schema-validators
Api gateway doesn't return a 400 if the path parameter isn't provided.
When I manually adjust the request validator like in the screenshot it works.
Is there any way to set the feature with sls or cf? The manually process is not production ready for me. Thanks in advance, Patrick
I am facing the exact same problem.
You can use this CF ressource as a workaround: RequestValidator: Type: AWS::ApiGateway::RequestValidator Properties: Name: 'custom-req-param-validator' RestApiId: !Ref ApiGatewayRestApi ValidateRequestParameters: true ValidateRequestBody: true
And then reference it in you function event: ..... events: - http: path: v1/foo method: get private: true reqValidatorName: 'RequestValidator'