{"id":15956,"library":"api-blueprint-http-formatter","title":"HTTP Request/Response to API Blueprint Formatter","description":"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.","status":"abandoned","version":"0.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/apiaryio/api-blueprint-http-formatter","tags":["javascript","api","blueprint","http"],"install":[{"cmd":"npm install api-blueprint-http-formatter","lang":"bash","label":"npm"},{"cmd":"yarn add api-blueprint-http-formatter","lang":"bash","label":"yarn"},{"cmd":"pnpm add api-blueprint-http-formatter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a CommonJS module. Direct ES module `import` syntax is not supported without a compatibility layer or bundler configuration. The primary export is the `format` function.","wrong":"import { format } from 'api-blueprint-http-formatter';","symbol":"format","correct":"const formatter = require('api-blueprint-http-formatter').format;"},{"note":"The package exports an object with a `format` method. While you can `require` the module and then access `.format`, it's often clearer to destructure or directly assign the `format` function if it's the only one you need. Direct default ESM imports will not work.","wrong":"import bf from 'api-blueprint-http-formatter';","symbol":"default export","correct":"const bf = require('api-blueprint-http-formatter');\nconst blueprint = bf.format(post);"},{"note":"For CommonJS modules, `require` returns the module.exports object. Using `import * as` for a CJS module in an ESM context might work depending on your build setup, but `require` is the intended usage.","wrong":"import * as formatterModule from 'api-blueprint-http-formatter';","symbol":"* as formatter","correct":"const formatterModule = require('api-blueprint-http-formatter');"}],"quickstart":{"code":"const bf = require('api-blueprint-http-formatter');\n\nconst httpPair = {\n  \"request\": {\n    \"method\": \"POST\",\n    \"uri\": \"/shopping-cart\",\n    \"headers\": {\n      \"User-Agent\": \"curl/7.24.0\",\n      \"Host\": \"api.example.com\",\n      \"Accept\": \"*/*\",\n      \"Content-Type\": \"application/json\",\n      \"Content-Length\": \"39\"\n    },\n    \"body\": \"{ \\\"product\\\":\\\"1AB23ORM\\\", \\\"quantity\\\": 2 }\"\n  },\n  \"response\": {\n    \"statusCode\": \"201\",\n    \"statusMessage\": \"Created\",\n    \"headers\": {\n      \"Content-Type\": \"application/json\",\n      \"Date\": \"Sun, 21 Jul 2009 14:51:09 GMT\",\n      \"X-Apiary-Ratelimit-Limit\": \"120\",\n      \"Content-Length\": \"50\"\n    },\n    \"body\": \"{ \\\"status\\\": \\\"created\\\", \\\"url\\\": \\\"/shopping-cart/2\\\" }\"\n  }\n};\n\nconst blueprintOutput = bf.format(httpPair);\nconsole.log(blueprintOutput);","lang":"javascript","description":"Demonstrates how to use the `format` function to convert an HTTP request/response pair into an API Blueprint formatted string."},"warnings":[{"fix":"Consider migrating to tools that support OpenAPI/Swagger, which is the current industry standard for API description and has robust, actively maintained tooling.","message":"This package is fundamentally unmaintained, with its last commit in 2014 and a 0.0.1 version. It is unlikely to receive updates for security vulnerabilities, bug fixes, or compatibility with newer Node.js versions or API Blueprint specification changes.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"For new projects, prefer using OpenAPI/Swagger. If maintaining existing API Blueprint documentation, be aware of the limited tooling and community support. Tools like `apib2openapi` might help with migration.","message":"The API Blueprint specification, while once popular, has largely been superseded by OpenAPI/Swagger. Many modern API design and documentation tools, including Apiary.io (a former champion of API Blueprint), have either shut down or shifted focus, making API Blueprint a less supported standard.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use `const bf = require('api-blueprint-http-formatter');` for importing this module.","message":"This package is a CommonJS module and does not natively support ES module (`import`) syntax. Attempting to `import` it directly in an ESM context will result in an error unless a transpilation step or a CommonJS compatibility loader is used.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Refer to Gavel's documentation for the exact expected `request` and `response` object structures to ensure correct formatting.","message":"The package expects input objects to conform to the HTTP request and response data models used by the Gavel validation tool. Deviations from this precise structure may lead to malformed or incorrect API Blueprint output.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Ensure you are using `const bf = require('api-blueprint-http-formatter');` and then calling `bf.format(post);`. If requiring from a local file, ensure the path `require('./src/api-blueprint-http-formatter')` is correct relative to your script.","cause":"This typically occurs if the module was `require`d incorrectly, or if the path to the formatter was wrong, leading to `bf` not being the expected module object with a `format` method.","error":"TypeError: bf.format is not a function"},{"fix":"Install the package using npm: `npm install api-blueprint-http-formatter` or ensure it's listed in your `package.json` dependencies and `npm install` has been run.","cause":"The package is not installed or not resolvable by Node.js.","error":"Error: Cannot find module 'api-blueprint-http-formatter'"}],"ecosystem":"npm"}