Blueprint Transactions library compiles HTTP Transactions (simple Request-Response pairs) from given API Blueprint AST.
Note: To better understand emphasized terms in this documentation, please refer to the Glossary of Terms. All data structures are described using the MSON format.
This project is superseded by the Dredd Transactions library.
- Inherits parameters from parent Resource and Action sections.
- Expands URI Templates.
- Warns on undefined placeholders in URI Templates (both query and path).
- Validates URI parameter types.
- Selects first Request and first Response if multiple are specified in the API Blueprint.
- Compiles Transaction Name string (vague identifier) for each Transaction.
- Provides Transaction Origin with pointers to the API Blueprint AST.
npm install blueprint-transactions
Blueprint Transactions library is written in CoffeeScript language which compiles to JavaScript (ECMAScript 5).
var bt = require('blueprint-transactions');
var transactions = bt.compile(ast, './apiary.apib');
Compiles HTTP Transactions from given API Blueprint AST.
transactions = compile(ast, filename);
ast
(API Blueprint AST) - API Blueprint AST provided as a JavaScript object.filename
(string) - Path to the API Blueprint file. Soon to be deprecated!transactions
(array[Transaction]) - Compiled Transaction objects.
API Blueprint AST represents contents of an API Blueprint file in machine-readable way. For details refer to API Blueprint AST specification.
Note: API Blueprint AST is deprecated and API Elements should be used instead. That's why also Blueprint Transactions are deprecated in favor of Dredd Transactions.
Represents a single HTTP Transaction (Request-Response pair) and its location in the API Blueprint document. The location is provided in two forms:
name
- String representation, both human- and machine-readable.origin
- Object of references to the original API Blueprint AST nodes.
- request (object) - HTTP Request as described in API Blueprint
- method
- uri:
/message
(string) - Informative URI of the Request - headers (object)
- body:
Hello world!\n
(string)
- response (object) - Expected HTTP Response as described in API Blueprint
- status:
200
(string) - headers (object)
- body (string)
- schema (string)
- status:
- name:
Hello world! > Retrieve Message
(string) - Transaction Name, non-deterministic breadcrumb location of the HTTP Transaction within the API Blueprint document - origin (object) - Object of references to the original API Blueprint AST nodes
- filename:
./blueprint.md
(string) - apiName:
My Api
(string) - resourceGroupName:
Greetings
(string) - resourceName:
Hello, world!
(string) - actionName:
Retrieve Message
(string) - exampleName:
First example
(string)
- filename: