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 🙏

© 2026 – Pkg Stats / Ryan Hefner

api2swagger-ext

v0.1.0

Published

Generate Swagger 2.0 (Open API) spec from Curl like API Call.

Readme

api2swagger-ext

Generate Swagger 2.0 (Open API) spec from Curl like API Call.

Installation

You can install api2swagger-ext either through npm or by cloning and linking the code from GitHub. This document covers the installation details for installing from npm.

Installation from npm

The api2swagger-ext module and its dependencies are designed for Node.js and is available through npm using the following command:

From a Terminal Window:

$ sudo npm install -g api2swagger-ext

input file structure

{
  "apiInfo": {    
    "host": "",
    "basePath": "",
    "schemes": [""],
    "consumes": [""],
    "produces": [""],
    "info": {
      "description": "",
      "title": "",
      "version": "",
      "termsOfService": "",
      "contact": {
        "email": ""
      }
    },
    "tags": [
      {
        "name": "",
        "description": ""
      }
    ],
    "metadata": {
      "tags": [],
      "description": ""
    }
  },
  "params": {
    "path": [],
    "query": [],
    "header": [],
    "body": {}    
  },
  "endpoint": "",
  "method":"",
  "outputExamples": [],
  "optionalResponse":{}
}

apiInfo

This tag contains the description for the API.

|Property|Type|Description |--|--|--| |"host"|string|API host |"basePath"|string|API base path |"schemes"|string|API supported schemas |"consumes"|string|API supported consumable types |"produces"|string|API output types

info

|Property|Type|Description |--|--|--| |"description"|string|API description |"title"|string|API title |"version"|string|API version |"termsOfService"|string|Terms of service text |"contact"|object|Contact info

tags

Array of API global tags

|Property|Type|Description |--|--|--| |"name"|string|API Tag name |"description"|string|API Tag description

metadata

Info related to a single API endpoint

|Property|Type|Description |--|--|--| |tags|string []|Array contains the API endpoint tags |description|string|API endpoint description

params

Contains the API endpoint parameters definitions

|Property|Type|Description |--|--|--| |path|object []|array of parameters that exists in the path| |query|object []|array of parameters that exists in the query string| |header|object []|array of parameters that exists in the request header| |body|object|json object representing the request/response body|

path & query

Each object in the list has the following structure

{
  "name": "",
  "description": "",
  "required": true,
  "type": "string"
}

No need to add the locale path parameter as it is already defined in the shared file.

header

Each object in the list has the following structure

{
  "name": "",
  "description": "",
  "type": "string"
}
body

Body parameter will be constructed based on the API execution response; use this property to override the desired parameter; or to specify the request body for put, patch, delete, and post mehods

Remark : You don't have to provide all parameters sections, just add what you need

endpoint

The full URL of the endpoint including all path parameters and replacement tags

method

The HTTP method GET, POST, PUT, DELETE, PATCH...

outputExamples

An array that contains actual calls to a deployed API to exctract the response from. The array could be a string or object array, if we the endpoint doesn't need any parameters outside the URL a string that represnts the desired url is enough, otherwise the object should have the follwoing structure

{
  "url": "",
  "body": {},
  "headers": []
}

|Property|Type|Description |--|--|--| |url|string|request url |body|oject|dynamic object represending the request body |headers|string []|request headers

Remarks : Make sure that the targeted server is up and running before run the documentation generation

optionalResponse

By default all properties in the response object -for both array and single object- are required, if the response has some optional parameteres the output can be overriden using the optionalResponse property using the following structure

{
  "optionalResponse":{
    "RESPONSE CODE" : ["OPTIONAL PARAMETER NAME",...]
  }
}

Example

{
  "optionalResponse":{
    "200" : ["id","responseId"]
  }
}