diff --git a/src/execute/oas3/parameter-builders.js b/src/execute/oas3/parameter-builders.js index 845df3448..a9a9a06c3 100644 --- a/src/execute/oas3/parameter-builders.js +++ b/src/execute/oas3/parameter-builders.js @@ -1,5 +1,3 @@ -import pick from 'lodash/pick'; - import stylize, { encodeDisallowedCharacters } from './style-serializer'; import serialize from './content-serializer'; @@ -45,9 +43,10 @@ export function query({ req, value, parameter }) { } if (value) { + const { style, explode, allowReserved } = parameter; req.query[parameter.name] = { value, - serializationOption: pick(parameter, ['style', 'explode', 'allowReserved']), + serializationOption: { style, explode, allowReserved }, }; } else if (parameter.allowEmptyValue && value !== undefined) { const paramName = parameter.name; diff --git a/src/http/index.js b/src/http/index.js index 42c1d2ba6..a85f8c565 100644 --- a/src/http/index.js +++ b/src/http/index.js @@ -1,7 +1,6 @@ import 'cross-fetch/polyfill'; /* global fetch */ import qs from 'qs'; import jsYaml from 'js-yaml'; -import pick from 'lodash/pick'; import isFunction from 'lodash/isFunction'; import { Buffer } from 'buffer'; import { FormData, File, Blob } from 'formdata-node'; @@ -229,12 +228,12 @@ function formatKeyValue(key, input, skipEncoding = false) { (type) => type !== 'undefined' ) ) { - return formatKeyValueBySerializationOption( - key, - value, - skipEncoding, - pick(encoding, ['style', 'explode', 'allowReserved']) - ); + const { style, explode, allowReserved } = encoding; + return formatKeyValueBySerializationOption(key, value, skipEncoding, { + style, + explode, + allowReserved, + }); } if (encoding.contentType) { diff --git a/src/interfaces.js b/src/interfaces.js index 5f3bb3f98..2bff2bd03 100644 --- a/src/interfaces.js +++ b/src/interfaces.js @@ -1,5 +1,3 @@ -import pick from 'lodash/pick'; - import { eachOperation, opId } from './helpers'; const nullFn = () => null; @@ -15,16 +13,20 @@ export const self = { // Make an execute, bound to arguments defined in mapTagOperation's callback (cb) export function makeExecute(swaggerJs = {}) { return ({ pathName, method, operationId }) => - (parameters, opts = {}) => - swaggerJs.execute({ + (parameters, opts = {}) => { + const { requestInterceptor, responseInterceptor, userFetch } = swaggerJs; + return swaggerJs.execute({ spec: swaggerJs.spec, - ...pick(swaggerJs, 'requestInterceptor', 'responseInterceptor', 'userFetch'), + requestInterceptor, + responseInterceptor, + userFetch, pathName, method, parameters, operationId, ...opts, }); + }; } // Creates an interface with tags+operations = execute