Skip to content

Simplifies the process of generating an API Gateway API from a swagger file.

Notifications You must be signed in to change notification settings

thomascclay/serverless-swagger-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Swagger API

This is a serverless plugin that simplifies the process of creating an AWS API Gateway from a swagger file.

Installation

yarn add --dev serverless-swagger-api

Configuration

Lambda Functions

You must manually create your own lambda functions in the serverless configuration. Once the methods are created, they will be referenced in the swagger file.

Swagger File

Add a x-lambda-name property to every path method to bind a part of the api to a lambda.

paths:
  /testPath:
    get:
      x-lambda-name: TestPathLambdaFunction
      ...

Plugin Settings

Now you need to tell the swagger api plugin about your configuration file. Add a swaggerApi property to the custom section of your serverless configuration. You can add as many apis as you want by adding children to the swaggerApi property.

custom:
  swaggerApi:
    PrimaryApi:
      Name: ${self:provider.stage}-${self:service}-PrimaryApi
      Body: ${file(./some-swagger-file.yaml)}
      Stage: dev

About

Simplifies the process of generating an API Gateway API from a swagger file.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%