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

auto-api-dog

v1.0.1

Published

a Node.JS CLI tool to easily generate api dog documentation file from your comments

Downloads

17

Readme

auto-api-dog NPM version NPM monthly downloads NPM total downloads

Easily document your REST APIs - auto-api-dog is a CLI tool that generates your api-dog documentation file from your comments

Please consider following this project's author, Sina Bayandorian, and consider starring the project to show your :heart: and support.

Table of Contents

Install

Install with npm:

$ npm install -g auto-api-dog

Usage

// package.json

{
  "scripts": {
    "doc": "auto-api-dog"
  }
}

Then :

$ npm run doc

Running the command above will output api.apidog.json that you can import into the api-dog application to have it generate your API documentation.

Format

Below is the document comment format :

/**
 * Description multi-line description
 * @name - Create A Post
 * @method POST
 * @endpoint /
 * @maintainer sina-byn
 * @status developing
 * @query {number} id the id of the post
 * 
 * @payload {object} - {
 *      "title": {
 *          "en": "this is the en title",
 *          "fa": "this is the fa title"
 *      }
 * }
 * 
 * @required {object} - {
 *      "title": {
 *         "required": true,
 *         "value": {
 *              "en": { "required": true },
 *              "fa": { "required": true }
 *         }
 *      }
 * }
 */

Visit comment parser, and JSDoc to read more about the documentation comments.

Note that if you use VS Code as your text editor it helps you with the asterisks.

Fields

Below is the table of all the fields that are defined for the cli. Make sure to read the notes below the table.

| Name | Type | Default | Description | |------------|--------|---------------------|---------------------------------------------------------------------| | name | string | "Untitled Endpoint" | the name of the API endpoint - special syntax | | method | string | | API endpoint's method - must be all in uppercase letters - required | | status | string | "released" | API dog status - visit api dog for more | | maintainer | string | | the maintainer id from the api dog project | | query | Param | | defines a single query parameter | | header | Param | | defines a single request header | | cookie | Param | | defines a single request cookie | | payload | JSON object | | defines the example payload for the request - important | | required | JSON object | | defines the required fields of the payload - important |

Notes

    • defining the required without the payload will result in an error

    • payload is optional and is used to create a JSON schema and a sample request body

    • the required field optional and is used to define the required fields of the JSON schema

    • Note that generating the request body and JSON schema is a complex task, and the developer is responsible for ensuring accuracy and that the types match. For example, in some cases where payload and required do not match, you might end up with an error; in other cases, your schema might simply not include all the required fields.

{
  type: "string",
  name: "post_slug",
  description: "desc",
  required: true,
  example: "first_post",
}

Note that support for complex data types for the Param type is yet to be added.

Example

/**
 * @header {number} id the id of the post
 */

is equal to

{
  type: "number",
  name: "id",
  description: "desc",
  required: true,
}

[id] : { required: false } [id=12] : { required: false, example: 12 } [!id=12] : { required: true, example: 12 }

Note that ! only works when an example is provided otherwise it will be included in the name of the param.

Options

| Name | Type | Default | Description | |-------------|--------|-----------|---------------------------------------------------------------| | -i, --input | string | "**/*.js" | glob pattern to match input files that have document comments | | -n, --name | string | "api" | output json file name - {name}.apidog.json |