0.0.6 • Published 3 years ago

op-converter v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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
  • Install op-converter
    npm install -g op-converter

Usage

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

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

NameValue
typeobject
mandatoryfalse

Example

{
  "path": {}
}

enableReplacePrefix

NameValue
typeboolean
parentpath
mandatoryfalse
mandatory siblingsreplacePrefix, replacePrefixWith

Example

{
  "path": {
    "enableReplacePrefix": true,
    "replacePrefix": "/v1",
    "replacePrefixWith": ""
  }
}

replacePrefix

NameValue
typestring
parentpath
mandatoryfalse
mandatory siblingsenableReplacePrefix, replacePrefixWith

Example

{
  "path": {
    "enableReplacePrefix": true,
    "replacePrefix": "/v1",
    "replacePrefixWith": ""
  }
}

replacePrefixWith

NameValue
typestring
parentpath
mandatoryfalse
mandatory siblingsenableReplacePrefix, replacePrefix

Example

{
  "path": {
    "enableReplacePrefix": true,
    "replacePrefix": "/v1",
    "replacePrefixWith": ""
  }
}

auth

Postman Auth field

NameValue
typeobject
mandatoryfalse

Example

{
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{CURRENT_ACCESS_TOKEN}}",
        "type": "string"
      }
    ]
  }
}

events

Postman event field

NameValue
typearray
mandatoryfalse

Example

{
  "events": [
    {
      "listen": "test",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ]
}

License

Distributed under the MIT License. See 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