Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openapi-to-postmanv2

Package Overview
Dependencies
Maintainers
8
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-to-postmanv2 - npm Package Compare versions

Comparing version 4.10.2 to 4.11.0

16

bin/openapi2postmanv2.js

@@ -15,2 +15,3 @@ #!/usr/bin/env node

swaggerInput,
interfaceVersion,
swaggerData;

@@ -45,2 +46,10 @@

});
/**
* As v2 interface uses parametersResolution instead of previous requestParametersResolution option,
* override value of parametersResolution if it's not defined and requestParametersResolution is defined
*/
if (_.has(parsedOptions, 'requestParametersResolution') && !_.has(parsedOptions, 'parametersResolution')) {
parsedOptions.parametersResolution = parsedOptions.requestParametersResolution;
}
return parsedOptions;

@@ -55,2 +64,3 @@ }

.option('-p, --pretty', 'Pretty print the JSON file')
.option('-i, --interface-version <interfaceVersion>', 'Interface version of convert() to be used')
.option('-c, --options-config <optionsConfig>', 'JSON file containing Converter options')

@@ -82,2 +92,3 @@ .option('-O, --options <options>', 'comma separated list of options', parseOptions);

prettyPrintFlag = program.pretty || false;
interfaceVersion = program.interfaceVersion || 'v2';
configFile = program.optionsConfig || false;

@@ -119,3 +130,4 @@ definedOptions = (!(program.options instanceof Array) ? program.options : {});

function convert(swaggerData) {
let options = {};
let options = {},
convertFn = interfaceVersion === 'v1' ? 'convert' : 'convertV2';

@@ -134,3 +146,3 @@ // apply options from config file if present

Converter.convert({
Converter[convertFn]({
type: 'string',

@@ -137,0 +149,0 @@ data: swaggerData

# OpenAPI-Postman Changelog
## [Unreleased]
## [v4.11.0] - 2021-04-14
### Added
- Fixed issue [#11680](https://github.com/postmanlabs/postman-app-support/issues/11680) Added support for contentType field for Formdata request bodies.
- Fixed issue [#10928](https://github.com/postmanlabs/postman-app-support/issues/10928) Added support for usage of interface version in CLI conversions with v2 as default.
### Fixed
- Fixed various known type errors related issues that were causing conversion errors.
- Fixed an issue where default response was not considered correctly while validating collection request response.
## Previous Releases
Newer releases follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.
#### v4.10.2 (March 13, 2023)

@@ -439,1 +456,5 @@ * Fixed issue where Accept header was generated correctly in convertV2() interface.

* Base release
[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.11.0...HEAD
[v4.11.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.10.2...v4.11.0

@@ -240,2 +240,15 @@ const generateAuthForCollectionFromOpenAPI = require('./helpers/collection/generateAuthForCollectionFromOpenAPI');

/**
* Provides ref stack limit for current instance
* @param {*} stackLimit - Defined stackLimit in options
*
* @returns {Number} Returns the stackLimit to be used
*/
getRefStackLimit = (stackLimit) => {
if (typeof stackLimit === 'number' && stackLimit > REF_STACK_LIMIT) {
return stackLimit;
}
return REF_STACK_LIMIT;
},
/**
* Resolve a given ref from the schema

@@ -250,5 +263,6 @@ * @param {Object} context - Global context object

resolveRefFromSchema = (context, $ref, stackDepth = 0, seenRef = {}) => {
const { specComponents } = context;
const { specComponents } = context,
{ stackLimit } = context.computedOptions;
if (stackDepth >= REF_STACK_LIMIT) {
if (stackDepth >= getRefStackLimit(stackLimit)) {
return { value: ERR_TOO_MANY_LEVELS };

@@ -320,5 +334,6 @@ }

resolveRefForExamples = (context, $ref, stackDepth = 0, seenRef = {}) => {
const { specComponents } = context;
const { specComponents } = context,
{ stackLimit } = context.computedOptions;
if (stackDepth >= REF_STACK_LIMIT) {
if (stackDepth >= getRefStackLimit(stackLimit)) {
return { value: ERR_TOO_MANY_LEVELS };

@@ -407,3 +422,3 @@ }

if (typeof exampleObj !== 'object') {
if (!exampleObj || typeof exampleObj !== 'object') {
return '';

@@ -474,3 +489,5 @@ }

if (stack >= REF_STACK_LIMIT) {
const { stackLimit } = context.computedOptions;
if (stack >= getRefStackLimit(stackLimit)) {
return { value: ERR_TOO_MANY_LEVELS };

@@ -481,2 +498,3 @@ }

// eslint-disable-next-line one-var
const compositeKeyword = schema.anyOf ? 'anyOf' : 'oneOf',

@@ -554,2 +572,7 @@ { concreteUtils } = context;

_.forOwn(schema.properties, (property, propertyName) => {
// Skip property resolution if it's not schema object
if (!_.isObject(property)) {
return;
}
if (

@@ -885,3 +908,3 @@ property.format === 'decimal' ||

let value = deepObject[key];
if (typeof value === 'object') {
if (value && typeof value === 'object') {
extractedParams = _.concat(extractedParams, extractDeepObjectParams(value, objectKey + '[' + key + ']'));

@@ -1222,2 +1245,3 @@ }

formDataParams = [],
encoding = {},
requestBodyData = {

@@ -1233,5 +1257,7 @@ mode: 'formdata',

bodyData = resolveRequestBodyData(context, requestBodyContent.schema);
encoding = _.get(requestBodyContent, 'encoding', {});
_.forOwn(bodyData, (value, key) => {
let requestBodySchema,
contentType = null,
paramSchema,

@@ -1253,2 +1279,6 @@ description,

if (typeof _.get(encoding, `[${key}].contentType`) === 'string') {
contentType = encoding[key].contentType;
}
// TODO: Add handling for headers from encoding

@@ -1272,2 +1302,5 @@

param.description = description;
if (contentType) {
param.contentType = contentType;
}

@@ -1735,4 +1768,5 @@ formDataParams.push(param);

_.forOwn(operationItem.responses, (responseSchema, code) => {
_.forOwn(operationItem.responses, (responseObj, code) => {
let response,
responseSchema = _.has(responseObj, '$ref') ? resolveSchema(context, responseObj) : responseObj,
{ includeAuthInfoInExample } = context.computedOptions,

@@ -1739,0 +1773,0 @@ responseAuthHelper,

2

package.json
{
"name": "openapi-to-postmanv2",
"version": "4.10.2",
"version": "4.11.0",
"description": "Convert a given OpenAPI specification to Postman Collection v2.0",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/postmanlabs/openapi-to-postman",

@@ -59,24 +59,27 @@

- `-s <source>`, `--spec <source>`
- `-s <source>`, `--spec <source>`
Used to specify the OpenAPI specification (file path) which is to be converted
- `-o <destination>`, `--output <destination>`
- `-o <destination>`, `--output <destination>`
Used to specify the destination file in which the collection is to be written
- `-p`, `--pretty`
- `-p`, `--pretty`
Used to pretty print the collection object while writing to a file
- `-O`, `--options`
- `-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](/OPTIONS.md)
- `-c`, `--options-config`
- `-c`, `--options-config`
Used to supply options to the converter through config file, for complete options details see [here](/OPTIONS.md)
- `-t`, `--test`
- `-t`, `--test`
Used to test the collection with an in-built sample specification
- `-v`, `--version`
- `-v`, `--version`
Specifies the version of the converter
- `-h`, `--help`
- `-h`, `--help`
Specifies all the options along with a few usage examples on the terminal

@@ -83,0 +86,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc