HTTP Request/Response to API Blueprint Formatter

0.0.1 · abandoned · verified Tue Apr 21

The `api-blueprint-http-formatter` package is a JavaScript utility designed to transform structured HTTP request and response objects into a string formatted according to the API Blueprint specification. It takes a JavaScript object containing `request` and `response` keys, adhering to the data model typically used by the Gavel validation tool, and outputs a textual representation suitable for API Blueprint documentation. The current and only released version is 0.0.1. This project appears to be abandoned, with its last commit on GitHub dating back to 2014, and is no longer actively maintained. The broader API Blueprint ecosystem has seen a general decline in new tooling and adoption, with the industry largely shifting towards OpenAPI/Swagger for API description, partly due to the shutdown of major platforms like Apiary.io which championed API Blueprint. This package focuses exclusively on formatting and does not offer parsing, validation, or other API Blueprint-related functionalities.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to use the `format` function to convert an HTTP request/response pair into an API Blueprint formatted string.

const bf = require('api-blueprint-http-formatter');

const httpPair = {
  "request": {
    "method": "POST",
    "uri": "/shopping-cart",
    "headers": {
      "User-Agent": "curl/7.24.0",
      "Host": "api.example.com",
      "Accept": "*/*",
      "Content-Type": "application/json",
      "Content-Length": "39"
    },
    "body": "{ \"product\":\"1AB23ORM\", \"quantity\": 2 }"
  },
  "response": {
    "statusCode": "201",
    "statusMessage": "Created",
    "headers": {
      "Content-Type": "application/json",
      "Date": "Sun, 21 Jul 2009 14:51:09 GMT",
      "X-Apiary-Ratelimit-Limit": "120",
      "Content-Length": "50"
    },
    "body": "{ \"status\": \"created\", \"url\": \"/shopping-cart/2\" }"
  }
};

const blueprintOutput = bf.format(httpPair);
console.log(blueprintOutput);

view raw JSON →