https://github.com/weikangchia/op-converter
Customizable Converter for OpenAPI 3.0 to Postman 2.1 Collections
https://github.com/weikangchia/op-converter
developer-tools oclif openapi3 postman postman-collection swagger tools typescript
Last synced: 4 months ago
JSON representation
Customizable Converter for OpenAPI 3.0 to Postman 2.1 Collections
- Host: GitHub
- URL: https://github.com/weikangchia/op-converter
- Owner: weikangchia
- License: mit
- Created: 2021-08-03T07:04:49.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-04T00:45:06.000Z (4 months ago)
- Last Synced: 2025-02-04T01:30:37.297Z (4 months ago)
- Topics: developer-tools, oclif, openapi3, postman, postman-collection, swagger, tools, typescript
- Language: TypeScript
- Homepage:
- Size: 255 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# OpenAPI 3.0 to Postman 2.1 Collections Converter
**op-converter** is a customizable converter for OpenAPI 3.0 to Postman 2.1 Collections.
## Getting Started
### Pre-requisites
- Install [node](https://nodejs.org/en/download/)
- Install op-converter
```
npm install -g op-converter
```### Usage
```sh-session
USAGE:
op-converterOPTIONS:
- f, --openApiFile=openApiFile path to your OpenAPI 3.0 JSON file
- h, --help show CLI help
- n, --name=name name for your postman collection
--baseUrl=baseUrl base url
--config=config custom config file name (default is config.json)
```**Examples**
```
op-converter -f ./openapi.json -n "My Collection" --baseUrl="http://localhost" > postman.json
```## Configuration Options
By default **op-converter** reads all configurable options from `config.json` at the following location
```
Unix: ~/.config/op-converter
Windows: %LOCALAPPDATA%\gitcg
```Below are the available configurable options.
- [path](#path)
- [enableReplacePrefix](#enableReplacePrefix)
- [replacePrefix](#replacePrefix)
- [replacePrefixWith](#replacePrefixWith)
- [auth](#auth)
- [events](#events)### path
| Name | Value |
| ------------- |-------------|
| type | object |
| mandatory | false |Example
```json
{
"path": {}
}
```#### enableReplacePrefix
| Name | Value |
| ------------- |-------------|
| type | boolean |
| parent | path |
| mandatory | false |
| mandatory siblings | replacePrefix, replacePrefixWith |Example
```json
{
"path": {
"enableReplacePrefix": true,
"replacePrefix": "/v1",
"replacePrefixWith": ""
}
}
```#### replacePrefix
| Name | Value |
| ------------- |-------------|
| type | string |
| parent | path |
| mandatory | false |
| mandatory siblings | enableReplacePrefix, replacePrefixWith |Example
```json
{
"path": {
"enableReplacePrefix": true,
"replacePrefix": "/v1",
"replacePrefixWith": ""
}
}
```#### replacePrefixWith
| Name | Value |
| ------------- |-------------|
| type | string |
| parent | path |
| mandatory | false |
| mandatory siblings | enableReplacePrefix, replacePrefix |Example
```json
{
"path": {
"enableReplacePrefix": true,
"replacePrefix": "/v1",
"replacePrefixWith": ""
}
}
```### auth
Postman Auth field
| Name | Value |
| ------------- |-------------|
| type | object |
| mandatory | false |Example
```json
{
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{CURRENT_ACCESS_TOKEN}}",
"type": "string"
}
]
}
}
```### events
Postman event field
| Name | Value |
| ------------- |-------------|
| type | array |
| mandatory | false |Example
```json
{
"events": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
]
}
```## License
Distributed under the MIT License. See [LICENSE](license) for more information.
## Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.## Contact
Wei Kang - weikangchia[@]gmail.com