serverless-openapi3-plugin

0.1.4 • Public • Published

serverless-openapi3-plugin

CircleCI npm version License: MIT

Serverless plugin to resolve $ref syntax of OpenAPI3

install

npm install --save serverless-openapi3-plugin

usage

plugins:
  - serverless-openapi3-plugin
 
custom:
  openApiPath: './resources/open-api/index.yaml' # OpenApi File 

When do you use it ?

When you want to use $ref syntax in OpenApi File, use this plugin.

example project

The example project uses example API of Amazon API Gateway.

.
├── resources
│   ├── api-gateway.yaml # ApiGateway Resource 
│   └── open-api
│       ├── index.yaml # OpenApi Entry File 
│       ├── components
│       │   └── schemas.yaml
│       └── paths
│           ├── pets-id.yaml
│           ├── pets.yaml
│           └── root.yaml
└── serverless.yml
# serverless.yaml 
...
resources:
  - ${file(./resources/api-gateway.yaml)}
# resources/api-gateway.yaml 
Resources:
  RestApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: rest-api
      Body: ${file(./resources/open-api/index.yaml)} # OpenApi Entry File 
# resources/open-api/index.yaml 
paths:
  /pets:
    $ref: './paths/pets.yaml'
  /pets/{petId}:
    $ref: './paths/pets-id.yaml'
  /:
    $ref: './paths/root.yaml'
 
components:
  schemas:
    $ref: './components/schemas.yaml'

/serverless-openapi3-plugin/

    Package Sidebar

    Install

    npm i serverless-openapi3-plugin

    Weekly Downloads

    1

    Version

    0.1.4

    License

    MIT

    Unpacked Size

    29.5 kB

    Total Files

    13

    Last publish

    Collaborators

    • ikkyu-3