postmanlabs/postman-code-generators is one of the open-source repositories TopGit tracks, currently at 1.0k stars, written primarily in JavaScript. Common repository for all code generators shipped with Postman
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
To run any of the postman-code-generators, ensure that you have NodeJS >= v8. A copy of the NodeJS installable can be downloaded from https://nodejs.org/en/download/package-manager.
Usage
Using postman-code-generators as a Library
There are three functions that are exposed in postman-code-generators: getLanguageList, getOptions, and convert.
getLanguageList
This function returns a list of supported code generators.
This function takes in three parameters and returns a callback with error and supported options of that code generator.
language - language key from the language list returned from getLanguageList function
variant - variant key provided by getLanguageList function
callback - callback function with first parameter as error and second parameter as array of options supported by the codegen.
A typical option has the following properties:
name - Display name
id - unique ID of the option
type - Data type of the option. (Allowed data types: boolean, enum, positiveInteger)
default - Default value. The value that is used if this option is not specified while creating code snippet
description - User friendly description.
Example:
var codegen = require('postman-code-generators'), // require postman-code-generators in your project
language = 'nodejs',
variant = 'Request';
codegen.getOptions(language, variant, function (error, options) {
if (error) {
// handle error
}
console.log(options);
});
// output:
// [
// {
// name: 'Set indentation count',
// id: 'indentCount',
// type: 'positiveInteger',
// default: 2,
// description: 'Set the number of indentation characters to add per code level'
// },
// {
// name: 'Set indentation type',
// id: 'indentType',
// type: 'enum',
// availableOptions: ['Tab', 'Space'],
// default: 'Space',
// description: 'Select the character used to indent lines of code'
// },
// ...
// ];
convert
This function takes in five parameters and returns a callback with error and generated code snippet
language - lang key from the language list returned from getLanguageList function
variant - variant key provided by getLanguageList function
request - Postman-SDK Request Object
options - Options that can be used to configure generated code snippet. Defaults will be used for the unspecified attributes
callback - callback function with first parameter as error and second parameter as string for code snippet
Example:
var codegen = require('postman-code-generators'), // require postman-code-generators in your project
sdk = require('postman-collection'), // require postman-collection in your project
request = new sdk.Request('https://www.google.com'), //using postman sdk to create request
language = 'nodejs',
variant = 'request',
options = {
indentCount: 3,
indentType: 'Space',
trimRequestBody: true,
followRedirect: true
};
codegen.convert(language, variant, request, options, function(error, snippet) {
if (error) {
// handle error
}
// handle snippet
});
Development
Installing dependencies
This command will install all the dependencies in production mode.
$ npm install;
To install dev dependencies also for all codegens run:
$ npm run deepinstall dev;
Testing
To run common repo test as well as tests (common structure test + individual codegen tests) for all the codegens
$ npm test;
To run structure and individual tests on a single codegen
$ npm test <codegen-name>;
# Here "codege-name" is the folder name of the codegen inside codegens folder
Packaging
To create zipped package of all codegens
$ npm run package;
Note: The zipped package is created inside each codegen's folder.
To create zipped package of a single codegen
$ npm run package <codegen-name>
Contributing
Please take a moment to read our contributing guide to learn about our development process.
Open an issue first to discuss potential changes/additions.
License
This software is licensed under Apache-2.0. Copyright Postman, Inc. See the LICENSE.md file for more information.
How active is development on postmanlabs/postman-code-generators?
The most recent commit recorded on postmanlabs/postman-code-generators was 2 months ago, based on the GitHub push timestamp. The repository has 382 forks — one of the better signals of community interest.
How many stars does postmanlabs/postman-code-generators have?
postmanlabs/postman-code-generators has 1.0k GitHub stars — refresh the page for the live number, or check github.com/postmanlabs/postman-code-generators. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is postmanlabs/postman-code-generators open source?
Yes — postmanlabs/postman-code-generators ships under the Apache-2.0 license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/postmanlabs/postman-code-generators.
What is postmanlabs/postman-code-generators?
postmanlabs/postman-code-generators (postmanlabs/postman-code-generators) is a JavaScript project on GitHub. From the project's own README: Common repository for all code generators shipped with Postman
Where do I read more about postmanlabs/postman-code-generators?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/postmanlabs/postman-code-generators is the definitive source.
Read full README in the tab above.
Is postman-code-generators worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of postman-code-generators.