Socket
Socket
Sign inDemoInstall

@8select/serverless-plugin-api-docs

Package Overview
Dependencies
0
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @8select/serverless-plugin-api-docs

serverless plugin that generates docs function to return swagger ui


Version published
Maintainers
2
Install size
12.0 kB
Created

Readme

Source

serverless-plugin-api-docs

serverless

Work with SWAGGER documentation for Serverless v1.0 projects.

A serverless plugin to automatically create a lambda function which returns the swagger-ui HTML based on the given swagger spec JSON file GET /docs => swagger-ui

Install

using npm:

npm install --save-dev @8select/serverless-plugin-api-docs

or yarn:

yarn add -D @8select/serverless-plugin-api-docs

Add the plugin to your serverless.yml file:

plugins:
  - serverless-plugin-api-docs

Prerequisites

Download and host swagger-ui library files e.g. with S3

  • swagger-ui.css
  • swagger-ui-bundle.js
  • swagger-ui-standalone-preset.js

Configuration

custom:
  documentation:
    contentUrl: '<URL_TO_YOUR_HOSTED_SWAGGER_UI_FILES>' # REQUIRED
    name: '<your_custom_lambda_function_name>' # OPTIONAL - default = 'docs'

To load your swagger.json you need to add a resolve.alias.
E.g. for webpack:
Assupmtion:

<root>
 |
 |-docs - REST API swagger spec & definitions
    | swagger.json
 | webpack.config.json
module.exports = {
  // [...],
  resolve: {
    alias: {
      PATH_TO_SWAGGER_SPEC: path.resolve(__dirname, 'docs/swagger.json'),
    },
  },
  // [...],
}

Keywords

FAQs

Last updated on 08 Dec 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc