refract-message-body-generator
v1.0.2
Published
Generates message bodies from JSON Schema in Refract tree
Downloads
5
Readme
Refract Message Body Generator
Generates message bodies from JSON Schema found within Refract API Description.
For example, it takes a message body schema asset and generates a message body asset.
It takes a Refract element such as the following:
{
"element": "asset",
"meta": {
"classes": ["messageBodySchema"]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\"type\": \"string\"}"
}
and it will place the following message body asset as a sibling of the that element
{
"element": "asset",
"meta": {
"classes": ["messageBody"]
},
"attributes": {
"contentType": "application/json"
},
"content": "\"ut omnis\""
}
Usage
import generateMessageBodies from 'refract-message-body-generator';
generateMessageBodies([Refract Element]);
Installation
$ npm install refract-message-body-generator