Skip to content

Commit

Permalink
docs: add cli references
Browse files Browse the repository at this point in the history
  • Loading branch information
joolfe committed Apr 30, 2021
1 parent 4fe0284 commit 739ea64
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 19 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Or in other words, transform [this specification](https://schema.getpostman.com/
[![docs](https://img.shields.io/badge/docs-here-yellow)](https://joolfe.github.io/postman-to-openapi/)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com)


## Installation

Using `npm`:
Expand All @@ -28,8 +27,16 @@ Using `yarn`:
yarn add postman-to-openapi
```

To install as a `cli` just

```bash
npm i postman-to-openapi -g
```

## Quick Usage

As a library

```js
// Require Package
const postmanToOpenApi = require('postman-to-openapi')
Expand Down Expand Up @@ -59,6 +66,12 @@ postmanToOpenApi(postmanCollection, outputFile, { defaultTag: 'General' })
})
```

As a cli

```bash
p2o ./path/to/PostmantoCollection.json -f ./path/to/result.yml -o ./path/to/options.json
```

## Documentation

All features, usage instructions and help can be found in the [Documentation page](https://joolfe.github.io/postman-to-openapi/)
Expand Down
53 changes: 38 additions & 15 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@

## Features at a glance

- Postman Collection v2.1 and v2.0.
- OpenApi 3.0
- Basic info API from Postman info or customizable.
- Basic method conversion (GET, POST, PUT...).
- Support Postman folders as tags.
- Transform query, headers and path parameters (description, required...).
- Postman variables as Path parameters.
- Automatic infer types from query and headers parameters.
- Support Json and Text body formats.
- Global Authorization parse or by configuration (Basic and Bearer).
- Contact and License from variables or by configuration.
- Provide meta-information as a markdown table.
- Path depth configuration.
- Response status code parse from test.
* Postman Collection v2.1 and v2.0.
* OpenApi 3.0
* 🆕 Cli available
* Basic info API from Postman info or customizable.
* Basic method conversion (GET, POST, PUT...).
* Support Postman folders as tags.
* Transform query, headers and path parameters (description, required...).
* Postman variables as Path parameters.
* Automatic infer types from query and headers parameters.
* Support Json and Text body formats.
* Global Authorization parse or by configuration (Basic and Bearer).
* Contact and License from variables or by configuration.
* Provide meta-information as a markdown table.
* Path depth configuration.
* Response status code parse from test.

See [Features](#features) section for more details about how to use each of this features.

Expand All @@ -37,17 +38,25 @@ See [Features](#features) section for more details about how to use each of this

# Install

To use local in your Node.js project as a library

```bash
npm i postman-to-openapi --save
```

To use as a cli coming soon...
To use as a cli

```bash
npm i postman-to-openapi -g
```

</div></div>
<div class="tilted-section"><div markdown="1">

# Usage

## As library

Use the library is as easy as use a single method `async postmanToOpenApi(inputPath, outputPath, options)`, the parameters are:

| Param | Description |
Expand Down Expand Up @@ -86,6 +95,20 @@ postmanToOpenApi(postmanCollection, outputFile, { defaultTag: 'General' })
})
```

## As cli

After install just need to

```bash
p2o ./path/to/PostmantoCollection.json -f ./path/to/result.yml -o ./path/to/options.json
```

All the field described in [options](#options) can be provided and used in the cli, for more info an all the available options just check the cli help

```bash
p2o -h
```

## Options

The third parameter used in the library method is an `options` object containing the optional parameters for the transformation, the allowed parameters are:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postman-to-openapi",
"version": "1.8.2",
"version": "1.8.0",
"description": "Convert postman collection to OpenAPI spec",
"main": "lib/index.js",
"bin": {
Expand Down

0 comments on commit 739ea64

Please sign in to comment.