Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed lodash.pick #2235

Merged
merged 2 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/execute/oas3/parameter-builders.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pick from 'lodash/pick';

import stylize, { encodeDisallowedCharacters } from './style-serializer';
import serialize from './content-serializer';

Expand Down Expand Up @@ -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;
Expand Down
13 changes: 6 additions & 7 deletions src/http/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 7 additions & 5 deletions src/interfaces.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pick from 'lodash/pick';

import { eachOperation, opId } from './helpers';

const nullFn = () => null;
Expand All @@ -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
Expand Down