API Gateway Models are defined using JSON Schema. You can reference a Model inside another Model using the $ref
field. If you are familiar with the OpenAPI Specification fka Swagger, you may have seen something like this:
{ |
To make model references work with API Gateway, you need to provide an absolute reference that is predefined by AWS: https://apigateway.amazonaws.com/restapis/$ApiId/models/$ModelName
Let’s translate this to a CloudFormation template:
{ |
That’s it. Now you can build sophisticated API Gateway models that reference each other in CloudFormation.
Read more:
- Master Customer Service with MB-230 Certification: Your 2025 Success Blueprint
- Create a serverless RESTful API with the Serverless Framework powered by API Gateway, Lambda, and DynamoDB
- Lessons learned: Serverless Chatbot architecture for marbot
- AWS Weekly 2016-33
- Connect to your EC2 instance using SSH the modern way