Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Latest commit

 

History

History
119 lines (73 loc) · 4.46 KB

README.md

File metadata and controls

119 lines (73 loc) · 4.46 KB

Deprecated Blueprint Transactions

Build Status Dependencies Status devDependencies Status Coverage Status

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.

Deprecation Notice

This project is superseded by the Dredd Transactions library.

Features

  • 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.

Deprecated Features

Installation

npm install blueprint-transactions

Development

Blueprint Transactions library is written in CoffeeScript language which compiles to JavaScript (ECMAScript 5).

Usage

var bt = require('blueprint-transactions');
var transactions = bt.compile(ast, './apiary.apib');

compile (function)

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.

Data Structures

API Blueprint AST (object)

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.

Transaction (object)

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.

Properties

  • 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)

Deprecated Properties

  • 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)