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

Native functions #2309

Merged
merged 15 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from 8 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"fast-json-patch": "^3.0.0-1",
"form-data-encoder": "^1.4.3",
"formdata-node": "^4.0.0",
"is-plain-object": "^5.0.0",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"qs": "^6.9.4",
Expand Down
2 changes: 1 addition & 1 deletion src/execute/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getIn from 'lodash/get';
import isPlainObject from 'lodash/isPlainObject';
import url from 'url';
import cookie from 'cookie';
import { isPlainObject } from 'is-plain-object';

import stockHttp, { mergeInQueryOrForm } from '../http';
import createError from '../specmap/lib/create-error';
Expand Down
2 changes: 1 addition & 1 deletion src/execute/oas3/build-request.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This function runs after the common function,
// `src/execute/index.js#buildRequest`
import { isPlainObject } from 'is-plain-object';
import get from 'lodash/get';
import isPlainObject from 'lodash/isPlainObject';
import btoa from 'btoa';

export default function buildRequest(options, req) {
Expand Down
6 changes: 2 additions & 4 deletions src/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import isObject from 'lodash/isObject';

const toLower = (str) => String.prototype.toLowerCase.call(str);
const escapeString = (str) => str.replace(/[^\w]/gi, '_');

Expand Down Expand Up @@ -136,7 +134,7 @@ export function normalizeSwagger(parsedSpec) {
for (const pathName in paths) {
const path = paths[pathName];

if (!isObject(path)) {
if (path == null || !['object', 'function'].includes(typeof path)) {
continue; // eslint-disable-line no-continue
}

Expand All @@ -145,7 +143,7 @@ export function normalizeSwagger(parsedSpec) {
// eslint-disable-next-line no-restricted-syntax, guard-for-in
for (const method in path) {
const operation = path[method];
if (!isObject(operation)) {
if (path == null || !['object', 'function'].includes(typeof path)) {
continue; // eslint-disable-line no-continue
}

Expand Down