Skip to content

Commit 1454f49

Browse files
committed
Removed unneccessary options merging with each util function
1 parent c527b80 commit 1454f49

File tree

2 files changed

+135
-82
lines changed

2 files changed

+135
-82
lines changed

lib/schemaUtils.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const { formatDataPath, checkIsCorrectType, isKnownType } = require('./common/sc
1616
openApiErr = require('./error.js'),
1717
ajvValidationError = require('./ajValidation/ajvValidationError'),
1818
utils = require('./utils.js'),
19-
defaultOptions = require('../lib/options.js').getOptions('use'),
2019
{ Node, Trie } = require('./trie.js'),
2120
{ validateSchema } = require('./ajValidation/ajvValidation'),
2221
inputValidation = require('./30XUtils/inputValidation'),
@@ -523,7 +522,6 @@ module.exports = {
523522
* @returns {*} combined requestParams from operation and path params.
524523
*/
525524
getRequestParams: function(operationParam, pathParam, components, options) {
526-
options = _.merge({}, defaultOptions, options);
527525
if (!Array.isArray(operationParam)) {
528526
operationParam = [];
529527
}
@@ -579,7 +577,6 @@ module.exports = {
579577
* @returns {Object} - The final object consists of the tree structure
580578
*/
581579
generateTrieFromPaths: function (spec, options, fromWebhooks = false) {
582-
options = _.merge({}, defaultOptions, options);
583580
let concreteUtils = getConcreteSchemaUtils({ type: 'json', data: spec }),
584581
specComponentsAndUtils = {
585582
concreteUtils
@@ -981,8 +978,6 @@ module.exports = {
981978
* @returns {Array<object>} returns an array of sdk.Variable
982979
*/
983980
convertPathVariables: function(type, providedPathVars, commonPathVars, components, options, schemaCache) {
984-
options = _.merge({}, defaultOptions, options);
985-
986981
var variables = [];
987982
// converting the base uri path variables, if any
988983
// commonPathVars is an object for type = root/method
@@ -1036,7 +1031,6 @@ module.exports = {
10361031
*/
10371032
convertChildToItemGroup: function (openapi, child, components, options,
10381033
schemaCache, variableStore, fromWebhooks = false) {
1039-
options = _.merge({}, defaultOptions, options);
10401034

10411035
var resource = child,
10421036
itemGroup,
@@ -1398,8 +1392,6 @@ module.exports = {
13981392
* @return {object} responseBody, contentType header needed
13991393
*/
14001394
convertToPmResponseBody: function(contentObj, components, options, schemaCache) {
1401-
options = _.merge({}, defaultOptions, options);
1402-
14031395
var responseBody, cTypeHeader, hasComputedType, cTypes,
14041396
isJsonLike = false;
14051397
if (!contentObj) {
@@ -1512,8 +1504,6 @@ module.exports = {
15121504
* @returns {*} first example in the input map type
15131505
*/
15141506
getExampleData: function(exampleObj, components, options) {
1515-
options = _.merge({}, defaultOptions, options);
1516-
15171507
var example,
15181508
exampleKey;
15191509

@@ -1556,7 +1546,6 @@ module.exports = {
15561546
convertToPmBodyData: function(bodyObj, requestType, contentType, parameterSourceOption,
15571547
indentCharacter, components, options, schemaCache) {
15581548

1559-
options = _.merge({}, defaultOptions, options);
15601549
var bodyData = '',
15611550
schemaFormat = SCHEMA_FORMATS.DEFAULT,
15621551
schemaType,
@@ -1672,7 +1661,6 @@ module.exports = {
16721661
* @returns {array} converted queryparam
16731662
*/
16741663
convertToPmQueryParameters: function(param, requestType, components, options, schemaCache) {
1675-
options = _.merge({}, defaultOptions, options);
16761664
var pmParams = [],
16771665
paramValue,
16781666
resolveTo = this.resolveToExampleOrSchema(requestType, options.requestParametersResolution,
@@ -1848,8 +1836,6 @@ module.exports = {
18481836
* @returns {Object} instance of a Postman SDK Header
18491837
*/
18501838
convertToPmHeader: function(header, requestType, parameterSource, components, options, schemaCache) {
1851-
options = _.merge({}, defaultOptions, options);
1852-
18531839
var fakeData,
18541840
convertedHeader,
18551841
reqHeader,
@@ -1891,7 +1877,6 @@ module.exports = {
18911877
* @returns {Object} - Postman requestBody and Content-Type Header
18921878
*/
18931879
convertToPmBody: function(requestBody, requestType, components, options, schemaCache) {
1894-
options = _.merge({}, defaultOptions, options);
18951880
var contentObj, // content is required
18961881
bodyData,
18971882
param,
@@ -2175,7 +2160,6 @@ module.exports = {
21752160
* @returns {Object} postman response
21762161
*/
21772162
convertToPmResponse: function(response, code, originalRequest, components, options, schemaCache) {
2178-
options = _.merge({}, defaultOptions, options);
21792163
var responseHeaders = [],
21802164
previewLanguage = 'text',
21812165
responseBodyWrapper,
@@ -2291,7 +2275,6 @@ module.exports = {
22912275
* @no-unit-tests
22922276
*/
22932277
getRefObject: function($ref, components, options) {
2294-
options = _.merge({}, defaultOptions, options);
22952278
var refObj, savedSchema;
22962279

22972280
if (typeof $ref !== 'string') {
@@ -2461,7 +2444,6 @@ module.exports = {
24612444
*/
24622445
convertRequestToItem: function(openapi, operationItem, components,
24632446
options, schemaCache, variableStore, fromWebhooks = false) {
2464-
options = _.merge({}, defaultOptions, options);
24652447
var reqName,
24662448
pathVariables = openapi.baseUrlVariables,
24672449
operation = operationItem.properties,
@@ -2825,7 +2807,6 @@ module.exports = {
28252807
* @returns {*} array of all query params
28262808
*/
28272809
convertToPmQueryArray: function(reqParams, requestType, components, options, schemaCache) {
2828-
options = _.merge({}, defaultOptions, options);
28292810
let requestQueryParams = [];
28302811
_.forEach(reqParams.query, (queryParam) => {
28312812
this.convertToPmQueryParameters(queryParam, requestType, components, options, schemaCache).forEach((pmParam) => {

0 commit comments

Comments
 (0)