Socket
Socket
Sign inDemoInstall

openapi-to-postmanv2

Package Overview
Dependencies
Maintainers
7
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.8.1-beta.1 to 4.9.0-beta.1

libV2/helpers/collection/generateAuthForCollectionFromOpenAPI.js

5

CHANGELOG.md
# OpenAPI-Postman Changelog
#### v4.9.0 (February 06, 2023)
* Fixed issue [#660](https://github.com/postmanlabs/openapi-to-postman/issues/660) where for certain XML request bodies, conversion was failing with TypeError.
* Fixed issue where for some definitions having non-string URLs were failing conversion with TypeErrors.
* Fixed issue where a test in-consistently kept failing due to uncertainity of jsf library.
#### v4.8.0 (January 24, 2023)

@@ -4,0 +9,0 @@ * Added specifictionVersion field to validate result.

@@ -17,2 +17,8 @@ 'use strict';

convertV2: function(input, options, cb) {
var schema = new SchemaPack(input, options);
return schema.convertV2(cb);
},
validate: function (input) {

@@ -19,0 +25,0 @@ var schema = new SchemaPack(input);

6

lib/31XUtils/schemaUtils31X.js

@@ -128,3 +128,3 @@ const inputValidation31X = require('./inputValidation31X'),

else if (hasProperties) {
const schemaProperties = Object.keys(schema.properties);
const schemaProperties = _.keys(schema.properties);
schemaProperties.forEach((property) => {

@@ -145,3 +145,3 @@ schema.properties[property] = this.fixExamplesByVersion(schema.properties[property]);

isBinaryContentType (bodyType, contentObj) {
return Object.keys(contentObj[bodyType]).length === 0 && fileUploadTypes.includes(bodyType);
return _.keys(contentObj[bodyType]).length === 0 && fileUploadTypes.includes(bodyType);
},

@@ -157,3 +157,3 @@

const resolvedSchema = _.cloneDeep(refSchema),
outerKeys = Object.keys(outerProps);
outerKeys = _.keys(outerProps);

@@ -160,0 +160,0 @@ if (_.isObject(resolvedSchema) && _.isObject(outerProps)) {

var _ = require('lodash');
const { formatDataPath } = require('../common/schemaUtilsCommon'),
// Mismatch severities
SEVERITY = {
INFO: 'info',
LOG: 'log',
WARNING: 'warning',
ERROR: 'error'
};
const { formatDataPath } = require('../common/schemaUtilsCommon');

@@ -31,4 +24,3 @@ /**

`${ajvValidationErrorObj.message}`,
reasonCode: 'INVALID_TYPE',
severity: SEVERITY.ERROR
reasonCode: 'INVALID_TYPE'
};

@@ -40,3 +32,2 @@

mismatchObj.reasonCode = 'MISSING_IN_SCHEMA';
mismatchObj.severity = SEVERITY.WARNING;
break;

@@ -56,3 +47,2 @@

`property "${_.get(ajvValidationErrorObj, 'params.missingProperty')}"`;
mismatchObj.severity = SEVERITY.ERROR;
break;

@@ -59,0 +49,0 @@

@@ -94,3 +94,3 @@ const _ = require('lodash'),

*
* @param {array} schemaArr REQUIRED - array of schemas, all of which must be valid in the returned object
* @param {*} schema REQUIRED - OpenAPI defined schema object to be resolved
* @param {string} parameterSourceOption REQUIRED tells that the schema object is of request or response

@@ -107,3 +107,3 @@ * @param {*} components REQUIRED components in openapi spec.

*/
resolveAllOf: function (schemaArr, parameterSourceOption, components, {
resolveAllOf: function (schema, parameterSourceOption, components, {
resolveFor = RESOLVE_REF_DEFAULTS.resolveFor,

@@ -117,19 +117,21 @@ resolveTo = RESOLVE_REF_DEFAULTS.resolveTo,

if (!(schemaArr instanceof Array)) {
if (_.isEmpty(schema)) {
return null;
}
if (schemaArr.length === 1) {
// for just one entry in allOf, don't need to enforce type: object restriction
return this.resolveRefs(schemaArr[0], parameterSourceOption, components,
{ stack, seenRef: _.cloneDeep(seenRef), resolveFor, resolveTo, stackLimit, analytics });
let resolvedNonAllOfSchema = {};
// Resolve schema excluding allOf keyword which will be further used to resolve entire schema along with allOf
if (_.keys(schema).length > 1) {
resolvedNonAllOfSchema = this.resolveRefs(_.omit(schema, 'allOf'), parameterSourceOption, components,
{ stack, seenRef: _.cloneDeep(seenRef), resolveFor, resolveTo, stackLimit, isAllOf: true, analytics });
}
try {
return mergeAllOf({
allOf: schemaArr.map((schema) => {
return mergeAllOf(_.assign(resolvedNonAllOfSchema, {
allOf: _.map(schema.allOf, (schema) => {
return this.resolveRefs(schema, parameterSourceOption, components,
{ stack, seenRef: _.cloneDeep(seenRef), resolveFor, resolveTo, stackLimit, isAllOf: true, analytics });
})
}, {
}), {
resolvers: {

@@ -252,3 +254,3 @@ // for keywords in OpenAPI schema that are not standard defined JSON schema keywords, use default resolver

if (schema.allOf) {
return this.resolveAllOf(schema.allOf, parameterSourceOption, components,
return this.resolveAllOf(schema, parameterSourceOption, components,
{

@@ -302,2 +304,5 @@ resolveFor,

if (resolvedSchema) {
if (schema.example) {
resolvedSchema.example = schema.example;
}
let refResolvedSchema = this.resolveRefs(resolvedSchema, parameterSourceOption,

@@ -304,0 +309,0 @@ components, {

@@ -29,2 +29,3 @@ 'use strict';

schemaUtils = require('./schemaUtils'),
v2 = require('../libV2/index'),
{ getServersPathVars } = require('./common/schemaUtilsCommon.js');

@@ -76,2 +77,22 @@

convertV2 (callback) {
if (!this.validated) {
return callback(new OpenApiErr('The schema must be validated before attempting conversion'));
}
// We only convert if swagger is found otherwise this.openapi remains the same
return convertToOAS30IfSwagger(getConcreteSchemaUtils(this.input), this.openapi, (error, convertedOpenAPI) => {
if (error) {
return callback(error);
}
this.openapi = convertedOpenAPI;
this.concreteUtils = concreteUtils;
this.specComponents = concreteUtils.getRequiredData(this.openapi);
v2.convertV2(this, callback);
});
}
// need to store the schema here

@@ -644,2 +665,30 @@ validate() {

/**
*
* @description Takes in a transaction object (meant to represent a Postman history object)
*
* @param {*} transactions RequestList
* @param {*} callback return
* @returns {boolean} validation
*/
validateTransactionV2(transactions, callback) {
let componentsAndPaths;
if (!this.validated) {
return callback(new OpenApiErr('The schema must be validated before attempting conversion'));
}
// this cannot be attempted before validation
componentsAndPaths = { concreteUtils };
Object.assign(componentsAndPaths, concreteUtils.getRequiredData(this.openapi));
return v2.validateTransactionV2({
schema: this.openapi,
options: this.computedOptions,
transactions: transactions,
componentsAndPaths: componentsAndPaths,
schemaCache: this.schemaFakerCache
}, callback);
}
static getOptions(mode, criteria) {

@@ -646,0 +695,0 @@ return getOptions(mode, criteria);

@@ -50,3 +50,3 @@ /* eslint-disable */

else {
childNodes += propVal;
childNodes += _.isString(propVal) ? propVal : '';
}

@@ -70,3 +70,3 @@ });

schemaItemsWithXmlProps.xml = schema.xml;
contents = convertSchemaToXML(arrayElemName, schemaItemsWithXmlProps, false, indentChar, indent + extraIndent) +
contents = convertSchemaToXML(arrayElemName, schemaItemsWithXmlProps, false, indentChar, indent + extraIndent) +
convertSchemaToXML(arrayElemName, schemaItemsWithXmlProps, false, indentChar, indent + extraIndent);

@@ -73,0 +73,0 @@ if (isWrapped) {

{
"name": "openapi-to-postmanv2",
"version": "4.8.1-beta.1",
"version": "4.9.0-beta.1",
"description": "Convert a given OpenAPI specification to Postman Collection v2.0",

@@ -128,2 +128,3 @@ "homepage": "https://github.com/postmanlabs/openapi-to-postman",

"object-hash": "3.0.0",
"graphlib": "2.1.8",
"path-browserify": "1.0.1",

@@ -130,0 +131,0 @@ "postman-collection": "4.1.5",

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