1.0.2 • Published 10 years ago

refract-message-body-generator v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
10 years ago

Refract Message Body Generator CircleCI Build Status

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