Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alextanghk/postmantodocx

Converting Postman collection(v2.1) Json file to word document(docx).
https://github.com/alextanghk/postmantodocx

postman

Last synced: about 2 months ago
JSON representation

Converting Postman collection(v2.1) Json file to word document(docx).

Awesome Lists containing this project

README

        

# Convert Postman API Document Json

Converting Postman collection Json file to MS Word document(docx).

- [Description](#description)
- [Environment](#environment)
- [Supporting Schema](#supporting-schema)
- [Installation](#installation)
- [Usage](#usage)
- [Command](#command)


## Description


Postman is a very useful tool for API testing and documentation, however it didn't provide the option on exporting the API document to Word document, so I created my own module to serve this purpose.


## Environment


Node JS Version: 12 or above


## Supporting Schema


- https://schema.postman.com/collection/json/v2.0.0/draft-07/collection.json
- https://schema.postman.com/collection/json/v2.1.0/draft-07/collection.json


## Installation
````
$ npm i postman-to-word -g // For cli
$ npm i postman-to-word // For node project
````

## Usage
To use this function in your code:


````
const postmanToDocx = require("postman-to-word");

// Promise return with true if success and throw Error when fail.
// postmanToDocx(schema: string, source: string, [outputPath: string])
postmanToDocx("2.1.0","/Souces/API.json","/Export");

````

## Command
You can also use cli to convert the json to docx file.


````
$ p2dx --sources= [--output=, --schema=]
Options:
--version Show version number [boolean]
-s, --source Full path of the json file. [string] [required]
-o, --output Output file path [string] [default: ""]
-c, --schema Version of Postman Collection schema
[string] [choices: "2.1.0", "2.0.0"] [default: "2.1.0"]
-h, --help Show help [boolean]

Examples:
p2dx --source=/root/API.json Export to same directory
p2dx --source=/root/API.json Export to same directory with schema
--schema=2.1.0 version
p2dx --source=/root/API.json Export to other directory
--output=/Export/
p2dx --source=/root/API.json Export to other directory with
--output=/Export/ --schema=2.1.0 schema version
````