@pwccnhk/o2p

0.0.8 • Public • Published

O2P - Toolkit for merging OpenAPI to Postman Collection

npm Version

Merge OpenAPI 3.0 to existing Postman Collection 2.1

This project is based on official Postman project openapi-to-postman with ability to merge the converted result to your existing Postman v2.1 collection.

The existing toolkit do the converting well, but if you're advanced user of Postman, you probably found that your pre-flight script, test cases, or even request model, examples get replaced for every convert. You can avoiding it by using


Options

-i / --import: File path to your OpenAPI 3.0 json/yaml

-e / --export: File path to export the converted result

-m / --merge (optional): File path to your existing postman, it will be merged to the converted result

Examples

  • To merge new changes from openapi.json with existing collection my-postman.json to postman.json, type the following command:

    o2p -i openapi.json -m my-postman.json -e postman.json
  • To just convert without merge

    o2p -i openapi.json -e postman.json

The rules

Add, Update, Delete or Replace? Check below table:

(This is better to have a config file or interactive interface to config the behaviour, welcome to contribute!)

Terminology:

  • Information: Project name, version
  • Variables: Environment variables, Global variable...etc. (ref. Postman Document)
  • Events: Pre-flight script, unit test scrips in Postman
  • Item: The actually API request
Item Only On Left Item On Both Item Only On Right
Information Add Update Delete
Variables Add No Action No Action
Events - No Action No Action
Item
- Url Host & Path - Update -
- Url Query Add No Action Delete
- Method - Update -
- Auth - Update -
- Headers Add No Action Delete
- Body (Both Raw) Add Conflict No Action
- Body (Both Form) Add No Action Delete
- Body (Other, Same type) Add No Action No Action
- Body (Other, Diff type) Add Update No Action
- Response (Example) Add Update Delete

Readme

Keywords

none

Package Sidebar

Install

npm i @pwccnhk/o2p

Weekly Downloads

2

Version

0.0.8

License

MIT

Unpacked Size

107 kB

Total Files

26

Last publish

Collaborators

  • rexlam0630