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

Commit

Permalink
Merge pull request #4 from apiaryio/honzajavorek/typos
Browse files Browse the repository at this point in the history
Fixing typos
  • Loading branch information
honzajavorek committed Jan 21, 2016
2 parents 84072b6 + cd65ab8 commit b8b88ba
Showing 1 changed file with 37 additions and 30 deletions.
67 changes: 37 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ This library takes API Blueprint AST and returns specific HTTP transactions (Req
- Inherits parameters from parent Resource and Action sections
- Expands URI templates
- Warns on undefined URI query and path parameters
- Validates URI parameteres types
- Selects first request and first response if multiple request or responses are given in the
- Assigns path origin object pointing to the Blueprint AST
- Compiles [cannonical transaction path](#canonical-transaction-paths) as a unique identifier for each transaction
- Assigns origin object pointing to the Blueprint AST [DEPRECATED]
- Validates URI parameter types
- Selects first request and first response if multiple request or responses are given in the API Blueprint AST
- Assigns path origin object pointing to the API Blueprint AST
- Compiles [canonical transaction path](#canonical-transaction-paths) as a unique identifier for each transaction
- Assigns origin object pointing to the API Blueprint AST [DEPRECATED]
- Compiles Transaction name string for each transaction [DEPRECATED]


## Installation

```
npm install blueprint-transactions
```


## Usage

```
Expand All @@ -35,54 +37,58 @@ transactions = compiler.compile(ast, './apiary.apib')

`transactions` is now an Array of compiled [Transaction Objects](#compiled-transaction-object-structure)


### Compiled Transaction Object Structure

Following is description is in a [MSON](https://github.com/apiaryio/mson) format

- transaction (object)
- name: `"Hello world! > Retrieve Message"` (string) Transaction identification name used for referencing
- path: `::Hello world!:Retreive Message:Example 1` (string) Transaction [cannonical path](#canonical-transaction-paths)
- name: `Hello world! > Retrieve Message` (string) - Transaction identification name used for referencing
- path: `::Hello world!:Retreive Message:Example 1` (string) - [Canonical transaction path](#canonical-transaction-paths)

- request (object) Request compiled from blueprint
- body `"Hello world!\n"` (string)
- request (object) - Request compiled from blueprint
- body: `Hello world!\n` (string)
- headers (object)
- uri `"/message"` (string) informative uri about the request
- uri: `/message` (string) - Informative URI of the request
- method

- response (object) Expected response from blueprint
- status `"200"` (string)
- response (object) - Expected response from blueprint
- status: `200` (string)
- headers (object)
- body (string)
- schema (string)

- pathOrigin (object) Reference to the original blueprint
- apiName `"My Api"` (string)
- resourceGroupName `"Greetings"` (string)
- resourceName `"Hello, world!"` (string)
- actionName `"Retrieve Message"` (string)
- exampleName `"First example"` (string)

- origin (object) [DEPRECATED, will be moved to Dredd reporter] Reference to the original blueprint for the human readeable name
- filename `"./blueprint.md"` (string)
- apiName `"My Api"` (string)
- resourceGroupName `"Greetings"` (string)
- resourceName `"Hello, world!"` (string)
- actionName `"Retrieve Message"` (string)
- exampleName `"First example"` (string)
- pathOrigin (object) - Reference to the original blueprint
- apiName: `My Api` (string)
- resourceGroupName: `Greetings` (string)
- resourceName: `Hello, world!` (string)
- actionName: `Retrieve Message` (string)
- exampleName: `First example` (string)

- origin (object) - [DEPRECATED, will be moved to Dredd reporter] Reference to the original blueprint for the human readable name
- filename: `./blueprint.md` (string)
- apiName: `My Api` (string)
- resourceGroupName: `Greetings` (string)
- resourceName: `Hello, world!` (string)
- actionName: `Retrieve Message` (string)
- exampleName: `First example` (string)


## Canonical transaction paths

Canonical transcation path is added to each compiled HTTP transciton as its identifier.
Canonical transcation path is added to each compiled HTTP transaction as its identifier.

Format of the transaction path is a concatenation/serialization of the `origin` object:

- Colon `:` character as a delimiter
- Examples are identified by string "Example " + its index in array starting from 1 (not 0)
- Colon character in API Name, Resource Name, Resource Group Name, Action Name or Example Name is escaed with backslash character `\`
- Colon character in API Name, Resource Name, Resource Group Name, Action Name or Example Name is escaped with backslash character `\`
- No other characters than colon `:` are escaped


# Examples


## 1. Full notation with multiple request-response pairs

```Markdown
Expand Down Expand Up @@ -121,6 +127,7 @@ Format of the transaction path is a concatenation/serialization of the `origin`
Some API Name:Some Group Name:Some Resource Name:Some Action Name:Example 2
```


## 2. Full notation without group

```Markdown
Expand Down Expand Up @@ -153,6 +160,7 @@ Some API Name:Some Group Name:Some Resource Name:Some Action Name:Example 2
Some API Name::Some Resource Name:Some Action Name:Example 1
```


## 3. Full notation without group and API name

```Markdown
Expand Down Expand Up @@ -183,6 +191,7 @@ Some API Name::Some Resource Name:Some Action Name:Example 1
::Some Resource Name:Some Action Name:Example 1
```


## 4. Full notation without group and API name with a colon

```Markdown
Expand Down Expand Up @@ -246,8 +255,6 @@ My API\: Revamp::Some Resource Name:Some Action Name:Example 1
```




## Contribution

Any contribution is more than welcome!
Expand Down

0 comments on commit b8b88ba

Please sign in to comment.