swagger-api / swagger-api/swagger-codegen

Allow more control over building request URL for javascript client

Open
#6,090 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Same as #5627 but for javascript (web). I need to prevent the JS library from calling encodeURIComponent on the path because forward slash characters need to be passed through correctly.

Swagger-codegen version

Latest - from editor.swagger.io/#/

Swagger declaration file content or url
Command line used for generation
Steps to reproduce

Generate a library that takes a parameter. Set the value of the parameter to something with a slash, e.g. users/3. It shouldn't be URL encoded to users%2F3.

Related issues/PRs

#5627

Suggest a fix/enhancement

Either update the library to accept a list of whitelisted characters not to URL encode, or a flag to disable URL encoding.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache, especially the linked URL-building call using encodeURIComponent. Reproduce the generated client with a path parameter such as users/3, then determine how the requested whitelist or opt-out should be exposed. Done means the generated JavaScript client preserves the slash as requested without breaking normal URL encoding.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.