@bb-cli/bb-convert-plugin-crud

CRUD plugin for BB Convert RAML

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@bb-cli/bb-convert-plugin-crud
Minified + gzip package size for @bb-cli/bb-convert-plugin-crud in KB

Readme

BB-Convert CRUD plugin middleware

This plugin will try to make generated mock stateful, so Create/Read/Update/Delete modifications will be visible in the response data. In simple words algorithm behind this plugin is the following:

  • At first, plugin will identify all methods, which potentially returns state response data – GET methods which retuns an array of items
  • After that, algorithm will try to find methods, which can perform Create/Read/Update/Delete operations on previously found state method

This plugin will only by applied in mock template.

Install alongside bb-convert (prefer global)

npm i -g @bb-cli/bb-convert-plugin-crud

Usage

bb-convert raml --transform-plugins @bb-cli/bb-convert-plugin-crud --template mock-ng
# OR
bb-convert raml --transform-plugins crud --template mock-ng

Configure in .bbconfig

CRUD plugin can be configured in .bbconfig file:

{
  "default": {
    "convert": {
      "raml": {
        "transform-plugins": "crud"
      }
    }
  }
}

With this configuration in place, you can simply run

bb-convert raml --template mock-ng

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.