API Gateway mock integration with Swagger / OpenAPI. How to set a mock body?

Have not been able to find a single example or documentation showing how to properly do a use swagger to define a mock integration for API Gateway. I just want to set up a mock integration as a stand-in backend to develop with:

x-amazon-apigateway-integration:
type: mock
responses:
default:
statusCode: 200
responseParameters:
method.response.header.Access-Control-Allow-Methods: “‘GET,HEAD,OPTIONS’”
method.response.header.Access-Control-Allow-Headers: “‘Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token’”
method.response.header.Access-Control-Allow-Origin: “‘*’”
passthroughBehavior: when_no_match
requestTemplates:
application/json: “{"statusCode": 200}”
responseTemplates: “{"helloBody": "helloBodyData"}”

what it do?


Related discussions:

You might have better use using LocalStack https://github.com/localstack/localstack

thanks this looks like a fantastic testing tool! Im partly testing my deployment and integration strategy right now, so using the actual gateway is part of it. But will bookmark localstack for future dev, looks great

Pro tip: Just manually create a sample mock integration that matches your requirements in the console and deploy it to a stage. Then you can export the swagger from the stage for an example of exactly how it should look.

pro tip indeed