How to use postman-collection-transformer - 4 common examples

To help you get started, we’ve selected a few postman-collection-transformer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github postmanlabs / newman / lib / run / options.js View on Github external
processCollection = function (collection, callback) {
        if (util.isV1Collection(collection)) {
            // @todo: route this via print module to respect silent flags
            console.warn('newman: Newman v4 deprecates support for the v1 collection format');
            console.warn('  Use the Postman Native app to export collections in the v2 format\n');

            return transformer.convert(collection, COLLECTION_TRANSFORMER_OPTION, callback);
        }

        callback(null, collection);
    },
github postmanlabs / newman / src / Newman.js View on Github external
//         Errors.terminateWithError("Not a valid POSTMAN globals file");
        //     }
        // }

        // Handle Cloud API
        if (_.get(options, 'envJson.environment.id')) {
            options.envJson = options.envJson.environment;
        }
        if (_.get(requestJSON, 'collection.info.schema')) {
            requestJSON = requestJSON.collection;
        }

        // Handle collection conversion
        if (_.get(requestJSON, 'info.schema')) {
            try {
                requestJSON = transformer.convert(requestJSON, {
                    inputVersion: '2.0.0',
                    outputVersion: '1.0.0'
                });
            }
            catch (e) {
                return console.error(e.stack || e);
            }
        }


        if(Math.random()<0.3) {
            checking = true;
            exec("npm show newman version", {timeout:1500}, function(error, stdout, stderr) {
                checking = false;
                stdout = stdout.trim();
                if (stdout !== Globals.newmanVersion && stdout.length > 0) {
github loadimpact / postman-to-k6 / lib / convert / object.js View on Github external
return new Promise((resolve, reject) => {
    transformer.convert(collection, upgradeOptions, (error, result) => {
      if (error) {
        reject(error)
      } else {
        resolve(result)
      }
    })
  })
}
github loadimpact / postman-to-loadimpact / lib / converters / postman-1.0.0.js View on Github external
convert: function(content, callback) {

    var options = {
      inputVersion: '1.0.0',
      outputVersion: '2.0.0'
    };

    transformer.convert(content, options, function (error, convertedContent) {

      if (error) {
        callback(error);
        return;
      }

      try {
        var collection = new Collection(convertedContent);
        var result = LuaGenerator.convert(collection)
        callback(null, result);
      } catch(error) {
        callback(error);
      }

    });

postman-collection-transformer

Perform rapid conversation and validation of JSON structure between Postman Collection Format v1 and v2

Apache-2.0
Latest version published 1 year ago

Package Health Score

71 / 100
Full package analysis

Popular postman-collection-transformer functions