Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
docs: getting started
Browse files Browse the repository at this point in the history
Close #47
  • Loading branch information
joolfe committed Jul 29, 2020
1 parent 78d2acc commit dcb1cf7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](./docs/assets/img/logo.png)

# postman-to-openapi
# [postman-to-openapi](https://joolfe.github.io/postman-to-openapi/)

🛸 Convert postman collection to OpenAPI specification.

Expand All @@ -9,7 +9,6 @@ Or in other words, transform [this specification](https://schema.getpostman.com/
[![build](https://github.com/joolfe/postman-to-openapi/workflows/Node.js%20CI/badge.svg)](https://github.com/joolfe/postman-to-openapi/actions)
[![codecov](https://codecov.io/gh/joolfe/postman-to-openapi/branch/master/graph/badge.svg)](https://codecov.io/gh/joolfe/postman-to-openapi)


## Documentation

All features, usage instructions and help can be found in the [Documentation page](https://joolfe.github.io/postman-to-openapi/)
Expand Down
30 changes: 29 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,38 @@ To use as a cli coming soon...

# Usage

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

| Param | Description |
|-|-|
| `inputPath` | String. Path of the Postman collection file. |
| `outputPath` | String. Path of the output file where the OpenAPi will be stored. |
| `options` | Object. Optional configuration, see [options](#Options) section for a detailed description.|

An example of usage:

```
const postmanToOpenApi = require('postman-to-openapi')
const result = await postmanToOpenApi('./path/to/postman/collection.json', './api/collection.yml', { save: true })
const postmanCollection = './path/to/postman/collection.json'
const outputFile = './api/collection.yml'
// Async/await
try {
const result = await postmanToOpenApi(postmanCollection, outputFile, { save: true })
console.log(`OpenAPI specs: ${result}`)
} catch (err) {
console.log(err)
}
// Promise callback style
postmanToOpenApi(postmanCollection, outputFile, { save: true })
.then(result => {
console.log(`OpenAPI specs: ${result}`)
})
.catch(err => {
console.log(err)
})
```

## Options
Expand Down

0 comments on commit dcb1cf7

Please sign in to comment.