问题
So, I've heard about request validator in API gateway.
Is it possible to validate request if it has atleast 1 parameter/querystring?
Example: Either name or id should be in the query string
https://something.domain.com/dev/employee?name=myname https://something.domain.com/dev/employee?id=myid
Basically, what I want is that before a Lambda function is executed, this should consider these conditions first
SHOULD have a parameter
Either a name or an id should be in that parameter
回答1:
API Gateway can perform the basic validation. For the basic validation, API Gateway verifies either or both of the following conditions:
The required request parameters in the URI, query string, and headers of an incoming request are included and non-blank.
The applicable request payload adheres to the configured JSON-Schema request model of the method.
To enable basic validation, you specify validation rules in a request validator, add the validator to the API's map of request validators, and assign the validator to individual API methods.
Please read documentation here
来源:https://stackoverflow.com/questions/47467838/api-gateway-validating-request-parameters