
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
postman-collection-code-generators
Advanced tools

Manage all of your organization's APIs in Postman, with the industry's most complete API development environment.
Supercharge your API workflow.
Modern software is built on APIs. Postman helps you develop APIs faster.
This library converts Postman Collection into client SDK of the chosen language.
Every sdk generator has two identifiers: language and variant.
language of sdk generator is the language in which client SDK is generated.variant of sdk generator is the main library name which is used in the generated SDK.| Language | Variant |
|---|---|
| Nodejs | Request |
To get started on your local machine.
$ git clone https://github.com/postmanlabs/postman-code-generators.git
To run any of the postman-collection-code-generators, ensure that you have NodeJS >= v12. A copy of the NodeJS installable can be downloaded [here] (https://nodejs.org/en/download/package-manager. )
There are three functions that are exposed in postman-collection-code-generators: getLanguageList, getSDKOptions & generate.
let sdkgen = require('pathToSdkgen');
console.log(sdkgen.getLanguageList());
// [
// {
// name: 'nodejs-request',
// language: 'nodejs',
// variant: 'request'
// }
// ...
// ]
General Options
This function takes in two optional parameters and returns an Array.
language - language key from the language list returned from getLanguageList functionvariant - variant key provided by getLanguageList functionA typical option has the following properties:
name - Display nameid - unique ID of the optiontype - Data type of the option. (Allowed data types: boolean, string)default - Default value. The value that is used if this option is not specified while creating SDK snippet.availableOptions - List of available options.required - Boolean to denote if its a required optiondescription - User-friendly description.let sdkgen = require('pathToSdkgen');
console.log(sdkgen.getSDKOptions());
// [
// {
// name: 'SDK Language',
// id: 'language',
// availableOptions: 'Use getSDKOptions method to get list of available sdkgens',
// type: 'String',
// default: '',
// required: true,
// description: 'Specifies Language for SDK generation'
// },
// {
// name: 'SDK language variant',
// id: 'variant',
// availableOptions: 'any',
// default: '',
// type: 'String',
// required: true,
// description: 'Specifies Language variant for SDK generation'
// }
// ...
// ]
let sdkgen = require('pathToSdkgen');
console.log(sdkgen.getSDKOptions('nodejs', 'request'));
// [
// {
// name: 'Set response return method',
// id: 'returnMethod',
// availableOptions: [ 'Callback', 'Promise' ],
// type: 'String',
// default: 'Callback',
// required: false,
// description: 'Set response return method got http response.'
// },
// {
// name: 'SDK output type',
// id: 'outputType',
// availableOptions: [ 'File', 'String' ],
// type: 'String',
// default: 'String',
// required: false,
// description: 'Specifies Type of Output for the generated SDK'
// },
// {
// name: 'SDK output file name',
// id: 'outputFilePath',
// availableOptions: null,
// type: 'String',
// default: '/home/wolf/development/postman-collection-code-generators/test/unit',
// required: false,
// description: 'Specifies output path for generated SDK'
// }
// ...
// ]
let sdkgen = require('pathToSdkgen');
sdkgen.generate({
type: 'string',
source: 'https://www.getpostman.com/collections/c8aa0d9bd381c73c5ac3'
}, {
language: 'Nodejs',
variant: 'request',
}, (err, snippet) => {
if (err) return console.log(err);
console.log(snippet);
});
This command will install all the dependencies in production mode.
$ npm install
To install dev dependencies also for all sdkgen run:
$ npm run deepinstall
To run common repo test as well as tests for all sdkgens
$ npm test
To run structure and individual tests on a single sdkgen
$ npm test <sdken-name>;
# Here "sdkgen-name" is the folder name of the sdkgen inside sdkgen folder
This software is licensed under Apache-2.0. Copyright Postman, Inc. See the LICENSE.md file for more information.
FAQs
Repository for generating code from Postman Collection.
We found that postman-collection-code-generators demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.