Gathering detailed insights and metrics for openapi-to-postmanv2
Gathering detailed insights and metrics for openapi-to-postmanv2
Gathering detailed insights and metrics for openapi-to-postmanv2
Gathering detailed insights and metrics for openapi-to-postmanv2
@types/openapi-to-postmanv2
TypeScript definitions for openapi-to-postmanv2
@paloaltonetworks/openapi-to-postmanv2
Convert a given OpenAPI specification to Postman Collection v2.0
@localz/openapi-to-postmanv2
Convert a given OpenAPI specification to Postman Collection v2.0
openapi-typescript
Convert OpenAPI 3.0 & 3.1 schemas to TypeScript
npm install openapi-to-postmanv2
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
930 Stars
2,472 Commits
200 Forks
22 Watching
223 Branches
79 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
JavaScript (99.75%)
Shell (0.25%)
Cumulative downloads
Total Downloads
Last day
-7.2%
10,244
Compared to previous day
Last week
2.3%
57,768
Compared to previous week
Last month
13.5%
267,180
Compared to previous month
Last year
65.4%
3,207,464
Compared to previous year
17
Supercharge your API workflow. Modern software is built on APIs. Postman helps you develop APIs faster.
To use the converter as a Node module, you need to have a copy of the NodeJS runtime. The easiest way to do this is through npm. If you have NodeJS installed you have npm installed as well.
1$ npm install openapi-to-postmanv2
If you want to use the converter in the CLI, install it globally with NPM:
1$ npm i -g openapi-to-postmanv2
The converter can be used as a CLI tool as well. The following command line options are available.
openapi2postmanv2 [options]
-s <source>
, --spec <source>
Used to specify the OpenAPI specification (file path) which is to be converted
-o <destination>
, --output <destination>
Used to specify the destination file in which the collection is to be written
-p
, --pretty
Used to pretty print the collection object while writing to a file
-i
, --interface-version
Specifies the interface version of the converter to be used. Value can be 'v2' or 'v1'. Default is 'v2'.
-O
, --options
Used to supply options to the converter, for complete options details see here
-c
, --options-config
Used to supply options to the converter through config file, for complete options details see here
-t
, --test
Used to test the collection with an in-built sample specification
-v
, --version
Specifies the version of the converter
-h
, --help
Specifies all the options along with a few usage examples on the terminal
1$ openapi2postmanv2 -s spec.yaml -o collection.json -p -O folderStrategy=Tags,includeAuthInfoInExample=false
1$ openapi2postmanv2 -s spec.yaml -o collection.json -p -c ./examples/cli-options-config.json
"<Error: Too many levels of nesting to fake this schema>"
kind of errors present in converted collection)1$ openapi2postmanv2 -s spec.yaml -o collection.json -p -O folderStrategy=Tags,requestParametersResolution=Example,optimizeConversion=false,stackLimit=50
1$ openapi2postmanv2 --test
In order to use the convert in your node application, you need to import the package using require
.
1var Converter = require('openapi-to-postmanv2')
The converter provides the following functions:
The convert function takes in your OpenAPI 3.0, 3.1 and Swagger 2.0 specification ( YAML / JSON ) and converts it to a Postman collection.
Signature: convert (data, options, callback);
data:
1{ type: 'file', data: 'filepath' } 2OR 3{ type: 'string', data: '<entire OpenAPI string - JSON or YAML>' } 4OR 5{ type: 'json', data: OpenAPI-JS-object }
options:
1{ 2 schemaFaker: true, 3 requestNameSource: 'fallback', 4 indentCharacter: ' ' 5} 6/* 7All three properties are optional. Check the options section below for possible values for each option. 8*/
Note: All possible values of options and their usage can be found over here: OPTIONS.md
callback:
1function (err, result) { 2 /* 3 result = { 4 result: true, 5 output: [ 6 { 7 type: 'collection', 8 data: {..collection object..} 9 } 10 ] 11 } 12 */ 13}
Check out complete list of options and their usage at OPTIONS.md
result
- Flag responsible for providing a status whether the conversion was successful or not.
reason
- Provides the reason for an unsuccessful conversion, defined only if result if false
.
output
- Contains an array of Postman objects, each one with a type
and data
. The only type currently supported is collection
.
1const fs = require('fs'), 2 Converter = require('openapi-to-postmanv2'), 3 openapiData = fs.readFileSync('sample-spec.yaml', {encoding: 'UTF8'}); 4 5Converter.convert({ type: 'string', data: openapiData }, 6 {}, (err, conversionResult) => { 7 if (!conversionResult.result) { 8 console.log('Could not convert', conversionResult.reason); 9 } 10 else { 11 console.log('The collection object is: ', conversionResult.output[0].data); 12 } 13 } 14);
The validate function is meant to ensure that the data that is being passed to the convert function is a valid JSON object or a valid (YAML/JSON) string.
The validate function is synchronous and returns a status object which conforms to the following schema
1{ 2 type: 'object', 3 properties: { 4 result: { type: 'boolean'}, 5 reason: { type: 'string' } 6 }, 7 required: ['result'] 8}
result
- true if the data looks like OpenAPI and can be passed to the convert function
reason
- Provides a reason for an unsuccessful validation of the specification
postman | openapi | related options |
---|---|---|
collectionName | info.title | - |
description | info.description + info.contact | - |
collectionVariables | server.variables + pathVariables | - |
folderName | paths.path / tags.name | folderStrategy |
requestName | operationItem(method).summary / operationItem(method).operationId / url | requestNameSource |
request.method | path.method | - |
request.headers | parameter (in = header ) | - |
request.body | operationItem(method).requestBody | requestParametersResolution, exampleParametersResolution |
request.url.raw | server.url (path level server >> openapi server) + path | - |
request.url.variables | parameter (in = path ) | - |
request.url.params | parameter (in = query ) | - |
api_key in (query or header) | components.securitySchemes.api_key | includeAuthInfoInExample |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/6 approved changesets -- score normalized to 6
Reason
4 commit(s) and 4 issue activity found in the last 90 days -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
7 existing vulnerabilities detected
Details
Reason
dangerous workflow patterns detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More