npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@amaplex-software/serverless-import-swagger

v0.1.3

Published

Import functions from swagger spec filet to serverless.yml

Downloads

10

Readme

serverless-import-swagger

Import functions from swagger spec filet to serverless.yml of Serverless Framework

Build Status

Install

$ npm install serverless-import-swagger

Add tag to Operation Object in swagger.yaml

Add sls-{service-name} tag to the operation that targeted by serverless.
Default prefix is "sls". If you want to use other prefix, call sls command with -A option.

Usage

Set swagger.yaml file on applicaion root directory.
If you want to apply common configs to serverless.yml, set serverless.common.yml file on application root directory.

Usage: sis [options]

  Import functions from swagger spec filet to serverless.yml

  Options:

    -h, --help                     output usage information
    -V, --version                  output the version number

    # Common options.
    -i, --input [path]             Specify swagger file path(s). (default "./swagger.ya?ml")
                                   It multiple paths given like `-i foo/swagger.yml -i bar/swagger.ymls, merged result is produced.
    -c, --common <path>            Specify common config of serverless file path. (default "./serverless.common.ya?ml")
    -o, --out-dir <path>           Specify dist directory of services. (default "./")
    -f, --force                    If add this option, overwriten serverless.yml by generated definitinos.

    # Services and tags prefix options.
    -A, --api-prefix <prefix>      Specify target prefix for swagger tags. (default "sls")
    -S, --service-prefix <prefix>  Specify prefix that added service name. (default none)

    # Base path mode that spliting large api specification settings.
    -B, --base-path                If add this option, run in a mode of dividing a service by a api base path.

    # CORS and OPTIONS method settings.
    -C, --cors                     If add this option, added cors setting to all http event.
    -O, --options-method           If add this option, added cors setting to get http event, and added OPTIONS method to api path that including other http method.

    # Other settings.
    --operation-id                 If this option is added and an API has operationId, the function is named from operationId.

Example

$ sis -i /path/to/swagger.yml -c /path/to/serverless.common.yml -o ./src

Caution

Serverless depends on constraints of amazon web service.
For example...

  • The maximum number of CloudFormation resources is 200. Therefore, APIs that contain many paths need to be divided using --base-path mode.
  • The function name of AWS Lambda must be 64 characters or less. For that reason, if long function names are generated, they can not be deployed.
  • API Gateway requires that path parameters in the same hierarchy be unique. Serverless also suffers from similar restrictions.