I am relatively new to AWS API Gateway. I am trying to make use of OpenAPI Components in the OpenAPI definition for the API Gateway.
I am trying to build reusable responses for the integration response as illustrated below.
This is a reusable component for 400 response (along with the mapping template for it):
components:
responses:
BAD_REQUEST:
statusCode: "400"
responseTemplates:
application/json: "#set($inputRoot = $input.path('$'))\n{ \n \"message\"\
: \"Invalid Request Body\"\n}"
And I am trying to use this under responses in the API Gateway Integration like below:
x-amazon-apigateway-integration:
<API_GATEWAY_CONFIG_GOES_HERE>
responses:
.*"BadRequest".*:
$ref: '#/components/responses/BAD_REQUEST'
When I deploy the whole CloudFormation stack I got that error and the stack could not be deployed:
Unable to put integration response on 'POST' for resource at path '/test_resource': Integration response status code must be non-empty
Any ideas?
pakage
command beforedeploy
if you use anchors From aws docs you can try this: docs.aws.amazon.com/apigateway/latest/developerguide/… But i haven't been able to get it working though! – json singh