op-converter is a customizable converter for OpenAPI 3.0 to Postman 2.1 Collections.
- Install node
- Install op-converter
npm install -g op-converter
USAGE:
op-converter
OPTIONS:
- 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
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.
Name | Value |
---|---|
type | object |
mandatory | false |
Example
{
"path": {}
}
Name | Value |
---|---|
type | boolean |
parent | path |
mandatory | false |
mandatory siblings | replacePrefix, replacePrefixWith |
Example
{
"path": {
"enableReplacePrefix": true,
"replacePrefix": "/v1",
"replacePrefixWith": ""
}
}
Name | Value |
---|---|
type | string |
parent | path |
mandatory | false |
mandatory siblings | enableReplacePrefix, replacePrefixWith |
Example
{
"path": {
"enableReplacePrefix": true,
"replacePrefix": "/v1",
"replacePrefixWith": ""
}
}
Name | Value |
---|---|
type | string |
parent | path |
mandatory | false |
mandatory siblings | enableReplacePrefix, replacePrefix |
Example
{
"path": {
"enableReplacePrefix": true,
"replacePrefix": "/v1",
"replacePrefixWith": ""
}
}
Postman Auth field
Name | Value |
---|---|
type | object |
mandatory | false |
Example
{
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{CURRENT_ACCESS_TOKEN}}",
"type": "string"
}
]
}
}
Postman event field
Name | Value |
---|---|
type | array |
mandatory | false |
Example
{
"events": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
]
}
Distributed under the MIT License. See LICENSE for more information.
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.
Wei Kang - weikangchia[@]gmail.com