Socket
Socket
Sign inDemoInstall

openapi-to-postmanv2

Package Overview
Dependencies
87
Maintainers
9
Versions
168
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.14.0 to 4.15.0-beta.0

19

CHANGELOG.md

@@ -5,2 +5,17 @@ # OpenAPI-Postman Changelog

## [v4.15.0] - 2023-06-27
### Added
- Added support for usage of XML examples of type string.
### Fixed
- Fixed issue where generated collection contained request and folder in incorrect order for v2 interface.
- Fixed issue where collection generation took very large time.
### Changed
- Reduced collection size by keeping maximum generated elements for array as 1 for definitions with larger schemas.
## [v4.14.0] - 2023-06-07

@@ -577,4 +592,6 @@

[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.14.0...HEAD
[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.15.0...HEAD
[v4.15.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.14.0...v4.15.0
[v4.14.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.13.0...v4.14.0

@@ -581,0 +598,0 @@

28

lib/bundle.js

@@ -297,2 +297,6 @@ const _ = require('lodash'),

commonPathFromData, allData, globalReferences) {
// eslint-disable-next-line no-console
console.log('debug-n', { currentNode, isOutOfRoot, parentFilename, globalReferences });
let referencesInNode = [],

@@ -721,11 +725,17 @@ nodeReferenceDirectory = {},

rootContextData = algorithm.traverseAndBundle(specRoot, (currentNode, globalReferences) => {
return getNodeContentAndReferences(
currentNode,
allData,
specRoot,
version,
initialMainKeys,
commonPathFromData,
globalReferences
);
try {
return getNodeContentAndReferences(
currentNode,
allData,
specRoot,
version,
initialMainKeys,
commonPathFromData,
globalReferences
);
} catch (e) { // eslint-disable-line
const newError = new ParseError(`Unable to get node content and references in ${currentNode.fileName}`);
newError.stack = e.stack;
throw newError;
}
});

@@ -732,0 +742,0 @@ components = generateComponentsWrapper(

@@ -53,3 +53,7 @@ /* eslint-disable */

else if (schema.type === 'object') {
if (resolveTo === 'example' && typeof schemaExample !== 'undefined') {
// Use mentioned example in string directly as example
if (resolveTo === 'example' && typeof schemaExample === 'string') {
return '\n' + schemaExample;
}
else if (resolveTo === 'example' && typeof schemaExample === 'object') {
const elementName = _.get(schema, 'items.xml.name', name || 'element'),

@@ -99,3 +103,7 @@ fakedContent = js2xml({ [elementName]: schemaExample }, indentChar);

if (resolveTo === 'example' && typeof schemaExample !== 'undefined') {
// Use mentioned example in string directly as example
if (resolveTo === 'example' && typeof schemaExample === 'string') {
return '\n' + schemaExample;
}
else if (resolveTo === 'example' && typeof schemaExample === 'object') {
const fakedContent = js2xml({ [arrayElemName]: schemaExample }, indentChar);

@@ -102,0 +110,0 @@

@@ -33,5 +33,3 @@ let _ = require('lodash'),

*/
const paths = Object.keys(openapi.paths).sort((a, b) => {
return (a > b ? -1 : 1);
});
const paths = Object.keys(openapi.paths);

@@ -156,14 +154,20 @@ if (_.isEmpty(paths)) {

else {
tree.setNode(`path:folder:${pathIdentifier}`, {
type: 'folder',
meta: {
name: path,
path: path,
pathIdentifier: pathIdentifier
},
data: {}
});
let fromNode = index === 0 ? 'root:collection' : `path:folder:${previousPathIdentified}`,
toNode = `path:folder:${pathIdentifier}`;
tree.setEdge(index === 0 ? 'root:collection' : `path:folder:${previousPathIdentified}`,
`path:folder:${pathIdentifier}`);
if (!tree.hasNode(toNode)) {
tree.setNode(toNode, {
type: 'folder',
meta: {
name: path,
path: path,
pathIdentifier: pathIdentifier
},
data: {}
});
}
if (!tree.hasEdge(fromNode, toNode)) {
tree.setEdge(fromNode, toNode);
}
}

@@ -170,0 +174,0 @@ });

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

// Maximum size of schema till whch we generate 2 elements per array (50 KB)
SCHEMA_SIZE_OPTIMIZATION_THRESHOLD = 50 * 1024,
PROPERTIES_TO_ASSIGN_ON_CASCADE = ['type', 'nullable', 'properties'],

@@ -595,24 +598,2 @@ crypto = require('crypto'),

else if (concreteUtils.compareTypes(schema.type, SCHEMA_TYPES.array) && schema.items) {
/*
For VALIDATION - keep minItems and maxItems properties defined by user in schema as is
FOR CONVERSION -
Json schema faker fakes exactly maxItems # of elements in array
Hence keeping maxItems as minimum and valid as possible for schema faking (to lessen faked items)
We have enforced limit to maxItems as 100, set by Json schema faker option
*/
if (resolveFor === CONVERSION) {
// Override minItems to default (2) if no minItems present
if (!_.has(schema, 'minItems') && _.has(schema, 'maxItems') && schema.maxItems >= 2) {
schema.minItems = 2;
}
// Override maxItems to minItems if minItems is available
if (_.has(schema, 'minItems') && schema.minItems > 0) {
schema.maxItems = schema.minItems;
}
// If no maxItems is defined than override with default (2)
!_.has(schema, 'maxItems') && (schema.maxItems = 2);
}
schema.items = resolveSchema(context, schema.items, stack, resolveFor, _.cloneDeep(seenRef));

@@ -776,5 +757,11 @@ }

try {
let key = hash(JSON.stringify(schema)),
let stringifiedSchema = typeof schema === 'object' && (JSON.stringify(schema)),
key = hash(stringifiedSchema),
restrictArrayItems = typeof stringifiedSchema === 'string' &&
(stringifiedSchema.length > SCHEMA_SIZE_OPTIMIZATION_THRESHOLD),
fakedSchema;
// unassign potentially larger string data after calculation as not required
stringifiedSchema = null;
if (context.schemaFakerCache[key]) {

@@ -785,3 +772,5 @@ return context.schemaFakerCache[key];

schemaFaker.option({
useExamplesValue: shouldGenerateFromExample
useExamplesValue: shouldGenerateFromExample,
defaultMinItems: restrictArrayItems ? 1 : 2,
defaultMaxItems: restrictArrayItems ? 1 : 2
});

@@ -788,0 +777,0 @@

@@ -53,3 +53,7 @@ /* eslint-disable */

else if (schema.type === 'object') {
if (resolveTo === 'example' && typeof schemaExample !== 'undefined') {
// Use mentioned example in string directly as example
if (resolveTo === 'example' && typeof schemaExample === 'string') {
return '\n' + schemaExample;
}
else if (resolveTo === 'example' && typeof schemaExample === 'object') {
const elementName = _.get(schema, 'items.xml.name', name || 'element'),

@@ -99,3 +103,7 @@ fakedContent = js2xml({ [elementName]: schemaExample }, indentChar);

if (resolveTo === 'example' && typeof schemaExample !== 'undefined') {
// Use mentioned example in string directly as example
if (resolveTo === 'example' && typeof schemaExample === 'string') {
return '\n' + schemaExample;
}
else if (resolveTo === 'example' && typeof schemaExample === 'object') {
const fakedContent = js2xml({ [arrayElemName]: schemaExample }, indentChar);

@@ -102,0 +110,0 @@

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

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

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc