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

rest-openapi-generator

v0.0.5

Published

RESTful Open API Spec generator with resource definitions.

Downloads

6

Readme

rest-openapi-generator

RESTful Open API Spec generator with resource definitions.

Currently only Swagger v2.0 is supported.

Install

$ npm install rest-openapi-generator

Usage

Configuration

First of all, create a configuration file by json or yaml.
By default the command refers to rogconfig.yaml on the application root, but you can optionally specify the file anywhere.

The configuration file has the following format.

rootDir: ./
output: ./openapi.yaml
openapi:
  info:
    title: Your REST API
    version: 0.0.0
  host: your.domain.com
  basePath: /api/v1
resources:
  - name: user
    schema: ./schemas/user.schema.json
  - name: calendar
    pathName: events
    directory: '/users/{userId}'
    schema:
      name: Event
      schema: http://json-schema.org/example/calendar.json
    tags:
      - event
    actions:
      list:
        tags:
          - event
        parameters:
          - name: userId
            in: path
            type: string
            required: true
          - name: location
            in: query
            type: string
            required: false
      create:
        tags:
          - event
        parameters:
          - name: userId
            in: path
            type: string
            required: true
      read:
        tags:
          - event
        parameters:
          - name: userId
            in: path
            type: string
            required: true
      update:
        tags:
          - event
        parameters:
          - name: userId
            in: path
            type: string
            required: true
      patch:
        tags:
          - event
        parameters:
          - name: userId
            in: path
            type: string
            required: true
      delete: false
  • rootDir
    • Root directory of the relative path inside the config file.
  • output
    • Destination directory and file name.
    • You can choose yaml or json.
  • openapi
    • Parameters that required for OpenAPI Specification.
    • When not entering, dummy values is inserted.
    • If necessary items are set, the values are also merged with the output.
  • resources
    • Setting of resource that you want to provide with REST API
    • Just by setting the name and the schema file, the REST API definition is generated.
    • You can also set the pathName and schema.name separately.
    • You can specify the directory to prepare the REST API with directory. Query parameters can also be used, but please add the parameter definition within each action.
    • You can add items available in Open API to each action of list, create, read, update, patch, delete.
    • If you do not want to create a specific action, set false.
    • If resource config contained tags, merge to each path tag parameter.

Command

Usage: rog [options]

  RESTful Open API Spec generator with resource definitions.

  Options:

    -V, --version         output the version number
    --c, --config <path>  Specify config file path. (default "./rogconfig.yaml")
    -h, --help            output usage information