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