openapi-to-postmanv2
Advanced tools
Comparing version 4.15.0 to 4.16.0-beta.0
@@ -711,2 +711,31 @@ 'use strict'; | ||
/** | ||
* @param {Object} schema Schema to be resolved and faked | ||
* @returns {Object} The faked value of the scehma provided | ||
*/ | ||
resolveAndFakeSchema(schema) { | ||
this.concreteUtils = concreteUtils; | ||
this.specComponents = concreteUtils.getRequiredData(this.openapi); | ||
let fakedValue; | ||
try { | ||
fakedValue = v2.resolveAndFakeSchema(this, schema); | ||
} | ||
catch (e) { | ||
// console.log('Error while faking or resolving: ', e); | ||
return { | ||
result: false, | ||
message: e.message, | ||
error: e | ||
}; | ||
} | ||
return { | ||
result: true, | ||
value: fakedValue | ||
}; | ||
} | ||
static getOptions(mode, criteria) { | ||
@@ -713,0 +742,0 @@ return getOptions(mode, criteria); |
@@ -17,2 +17,6 @@ /* eslint-disable */ | ||
if (schema === null || typeof schema === 'undefined') { | ||
return retVal; | ||
} | ||
const schemaExample = typeof schema === 'object' && (schema.example); | ||
@@ -19,0 +23,0 @@ |
@@ -18,3 +18,3 @@ /* eslint-disable one-var */ | ||
const { resolvePostmanRequest } = require('./schemaUtils'); | ||
const { resolvePostmanRequest, resolveAndFakeSchema } = require('./schemaUtils'); | ||
const { generateRequestItemObject, fixPathVariablesInUrl } = require('./utils'); | ||
@@ -299,3 +299,9 @@ | ||
}); | ||
}, | ||
resolveAndFakeSchema(context, schema) { | ||
context.schemaCache = context.schemaCache || {}; | ||
return resolveAndFakeSchema(context, schema); | ||
} | ||
}; |
@@ -790,2 +790,17 @@ const generateAuthForCollectionFromOpenAPI = require('./helpers/collection/generateAuthForCollectionFromOpenAPI'); | ||
/** | ||
* Resolve a given ref from the schema | ||
* | ||
* @param {Object} context - Global context | ||
* @param {Object} schema - Schema that is to be resolved | ||
* | ||
* @returns {Object} Faked data | ||
*/ | ||
resolveAndFakeSchema = (context, schema) => { | ||
const resolvedSchema = resolveSchema(context, schema), | ||
fakedValue = fakeSchema(context, resolvedSchema); | ||
return fakedValue; | ||
}, | ||
/** | ||
* Resolve value of a given parameter | ||
@@ -1908,3 +1923,4 @@ * | ||
resolveRefFromSchema, | ||
resolveAndFakeSchema, | ||
resolveSchema | ||
}; |
@@ -17,2 +17,6 @@ /* eslint-disable */ | ||
if (schema === null || typeof schema === 'undefined') { | ||
return retVal; | ||
} | ||
const schemaExample = typeof schema === 'object' && (schema.example); | ||
@@ -19,0 +23,0 @@ |
{ | ||
"name": "openapi-to-postmanv2", | ||
"version": "4.15.0", | ||
"version": "4.16.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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1833364
60
48067
16
1
4