Socket
Socket
Sign inDemoInstall

draig-oag

Package Overview
Dependencies
0
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    draig-oag

Distribution of the openapitools openapi-generator with modified cli


Version published
Weekly downloads
1
decreased by-95.24%
Maintainers
1
Install size
22.8 MB
Created
Weekly downloads
 

Readme

Source

draig: database REST API interactive generator

What is DRAIG

DRAIG is a JS (NodeJS, ExpressJS, KnexJS, Objection.js) DB-backed microservice code generator derived from the excellent openapi-generator for DbC (Design by Contract or Contract Based Development). You provide or design a contract (API definition in YAML) and the generator generates, for you, the DB tables, a fake (seed) initial database and the glue code (side effects) for CRUD operations.

With some more work (i.e. if you provide KnexJS or Objection queries) you can have complex DB interactions exposed as microservices in minutes.

DRAIG works seamlessly with draig-car, a CLI and REPL tool to design the contract and the queries, generate the code test the API and much more without leaving the REPL or using a simple and readline-powered CLI.

Under the hood, draig-car uses docker (only in available in some target platforms) to pull, create and manage the database instances required to deploy the API in MySQL (MariaDB), PostgreSQL or Oracle in a transparent fashion. The queries and DB operations are DB independent, so you don't have to worry (although you want it to) about hosts, ports, admin users, etc. You can, however, use SQLite as the DB provider for testing or production use (if you dare) without the need for a docker container.

How to use

Run

> npm -g install draig-oag`

For development work on draig itself, clone this repo, cd to draig dir and then run:

> npm -g install

The local working copy of the repository will be then linked with your installation. Use it alone or with draig-car.

Using as standalone generator

This is a new modified distribution of openapi-generator. So, once installed, you only have to use it like this:

> openapi-generator generate -g draig <rest of params>

What's OpenAPI

The goal of OpenAPI is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection.

When properly described with OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service.

Check out OpenAPI-Spec for additional information about the OpenAPI project, including additional libraries with support for other languages and more.

How do debug openapi-generator output?

The following additional debug options are available for all codegen targets:

# -DdebugOpenAPI prints the OpenAPI Specification as interpreted by the codegen
# -DdebugModels prints models passed to the template engine
# -DdebugOperations prints operations passed to the template engine
# -DdebugSupportingFiles prints additional data passed to the template engine

FAQs

Last updated on 25 Feb 2022

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