From 739ea64f289d61706f7ddb644a619fe6bfc65eaf Mon Sep 17 00:00:00 2001 From: Jorge Date: Fri, 30 Apr 2021 09:41:13 +0200 Subject: [PATCH] docs: add cli references --- README.md | 15 +++++++++++++- docs/index.md | 53 +++++++++++++++++++++++++++++++++-------------- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index cf03b06..e42b3dc 100644 --- a/README.md +++ b/README.md @@ -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`: @@ -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') @@ -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/) diff --git a/docs/index.md b/docs/index.md index ef87f90..c13bde1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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. @@ -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 +```
# Usage +## As library + Use the library is as easy as use a single method `async postmanToOpenApi(inputPath, outputPath, options)`, the parameters are: | Param | Description | @@ -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: diff --git a/package-lock.json b/package-lock.json index fa2f72c..9d4ca75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "postman-to-openapi", - "version": "1.8.2", + "version": "1.8.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.8.2", + "version": "1.8.0", "license": "MIT", "dependencies": { "commander": "^7.2.0", diff --git a/package.json b/package.json index 66fc6d3..0110140 100644 --- a/package.json +++ b/package.json @@ -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": {