Skip to content

Instantly share code, notes, and snippets.

@georgmao
Last active April 27, 2021 02:45
Show Gist options
  • Save georgmao/daf51e07c3aacb9e9199c3775b38d16a to your computer and use it in GitHub Desktop.
Save georgmao/daf51e07c3aacb9e9199c3775b38d16a to your computer and use it in GitHub Desktop.
A basic SAM Template for an API that uses DefinitionBody and multiple OpenApi specs
# Create a HttpApi with a YAML OpenAPI Spec
# Use Tranform Includes to dynamically import parts of the API via OpenAPI Specs
Type: AWS::Serverless::HttpApi or #AWS::Serverless::Api (REST APIs)
Properties:
DefinitionBody:
openapi: 3.0.1
info:
title: "myAPI-splitspecs"
version: "2019-02-07T22:41:10Z"
paths:
'Fn::Transform':
Name: 'AWS::Include'
# Replace <bucket> with your bucket name
Parameters:
#Location: ./restapi-openapi.yaml # s3://<bucket>/openapi-apigateway.yaml -- use this to pull from S3
Location: ./httpapi-openapi.yaml # s3://<bucket>/openapi-apigateway.yaml -- use this to pull from S3
'Fn::Transform':
Name: 'AWS::Include'
# Replace <bucket> with your bucket name
Parameters:
#Location: ./restapi-openapi.yaml # s3://<bucket>/openapi-apigateway.yaml -- use this to pull from S3
Location: ./httpapi-openapi2.yaml # s3://<bucket>/openapi-apigateway.yaml -- use this to pull from S3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment