diff --git a/README.md b/README.md index e22ad19..dac8324 100644 --- a/README.md +++ b/README.md @@ -10,21 +10,25 @@ Or in other words, transform [this specification](https://schema.getpostman.com/ [![codecov](https://codecov.io/gh/joolfe/postman-to-openapi/branch/master/graph/badge.svg)](https://codecov.io/gh/joolfe/postman-to-openapi) [![npm version](https://img.shields.io/npm/v/postman-to-openapi )](https://www.npmjs.com/package/postman-to-openapi) -[![dcos](https://img.shields.io/badge/docs-here-yellow)](https://joolfe.github.io/postman-to-openapi/) +[![docs](https://img.shields.io/badge/docs-here-yellow)](https://joolfe.github.io/postman-to-openapi/) ## Installation Using `npm`: -`npm i postman-to-openapi` +```bash +npm i postman-to-openapi +``` Using `yarn`: -`yarn add postman-to-openapi` +```bash +yarn add postman-to-openapi +``` ## Quick Usage -``` +```js // Require Package const postmanToOpenApi = require('postman-to-openapi') @@ -33,30 +37,24 @@ const postmanCollection = './path/to/postman/collection.json' // Output OpenAPI Path const outputFile = './api/collection.yml' -// Convert Postman collection to OpenAPI using Async/Await -const collectionToOpenAPI = async () => { - try { - const result = await postmanToOpenApi(postmanCollection, outputFile, { defaultTag: 'General' }) - // Without save the result in a file - const result2 = await postmanToOpenApi(postmanCollection, null, { defaultTag: 'General' }) +// Async/await +try { + const result = await postmanToOpenApi(postmanCollection, outputFile, { defaultTag: 'General' }) + // Without save the result in a file + const result2 = await postmanToOpenApi(postmanCollection, null, { defaultTag: 'General' }) + console.log(`OpenAPI specs: ${result}`) +} catch (err) { + console.log(err) +} + +// Promise callback style +postmanToOpenApi(postmanCollection, outputFile, { defaultTag: 'General' }) + .then(result => { console.log(`OpenAPI specs: ${result}`) - } catch (err) { + }) + .catch(err => { console.log(err) - } -} -collectionToOpenAPI(); - -// Convert Postman collection to OpenAPI using Promise Callback -const collectionToOpenAPI = async () => { - postmanToOpenApi(postmanCollection, outputFile, { defaultTag: 'General' }) - .then(result => { - console.log(`OpenAPI specs: ${result}`) - }) - .catch(err => { - console.log(err) - }) -} -collectionToOpenAPI(); + }) ``` ## Documentation diff --git a/package-lock.json b/package-lock.json index 1105720..0f0cb55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "postman-to-openapi", - "version": "1.7.0", + "version": "1.7.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.7.0", + "version": "1.7.1", "license": "MIT", "dependencies": { "js-yaml": "^4.0.0", diff --git a/package.json b/package.json index 2d41c96..00ce3d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postman-to-openapi", - "version": "1.7.0", + "version": "1.7.1", "description": "Convert postman collection to OpenAPI spec", "main": "lib/index.js", "scripts": {