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

Consider replacing qs with URLSearchParams #3585

Closed
wojtekmaj opened this issue Jul 10, 2024 · 2 comments
Closed

Consider replacing qs with URLSearchParams #3585

wojtekmaj opened this issue Jul 10, 2024 · 2 comments
Assignees
Labels
dependencies Pull requests that update a dependency file type: enhancement version: 3.x

Comments

@wojtekmaj
Copy link

Is your feature request related to a problem?

qs is pulling in 14 other dependencies with it: https://npmgraph.js.org/[email protected], making swagger-js installing, evaluating and running slower than it could. On top of that, since qs is being maintained by you-know-who, changes are that even more needless dependencies will pop up in the dependency tree.

Describe the solution you'd like

Consider replacing qs with URLSearchParams.

Describe alternatives you've considered

Custom function like:

function stringify(obj) {
    function stringifyInner(obj, parentKey) {
        return Object.entries(obj).flatMap(([key, value]) => {
            const fullKey = `${parentKey}[${key}]`;
            if (typeof value === 'object') return stringifyInner(value, fullKey)
            return [[fullKey, value]]
        })
    }
    return new URLSearchParams(Object.entries(obj).flatMap(([k, v]) => {
        if (typeof v === 'object') return stringifyInner(v, k)
        return [[k, v]]
    }));
}

if nested value support would be needed.

@char0n
Copy link
Member

char0n commented Aug 11, 2024

Started the effort in #3633

@char0n
Copy link
Member

char0n commented Aug 11, 2024

@wojtekmaj addressed in #3634. I would appreciated your review.

@char0n char0n self-assigned this Aug 11, 2024
@char0n char0n added version: 3.x type: enhancement dependencies Pull requests that update a dependency file labels Aug 11, 2024
@char0n char0n closed this as completed Aug 12, 2024
char0n added a commit that referenced this issue Aug 12, 2024
swagger-bot pushed a commit that referenced this issue Aug 12, 2024
## [3.29.1](v3.29.0...v3.29.1) (2024-08-12)

### Bug Fixes

* **deps:** replace qs with native URLSearchParams ([b2f4c38](b2f4c38)), closes [#3606](#3606) [#3585](#3585)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file type: enhancement version: 3.x
Projects
None yet
Development

No branches or pull requests

2 participants