swagger-api / swagger-api/swagger-codegen

Typescript-angular2 - Allow empty basePath as OpaqueToken

Open
#6,078 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Under https://github.com/swagger-api/swagger-codegen/blob/ba704e3ac8635d2c35d87fbfb3e0243cf6f35da8/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache

the basePath check doesn't allow to have an empty string so it ill be set to the default value of basePath

Instead of

if (basePath) {
    this.basePath = basePath;
}

it should be:

if (basePath !== null) {
    this.basePath = basePath;
}
Swagger-codegen version

latest

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

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

Open modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache and inspect the basePath conditional. Check the generated TypeScript Angular 2 client behavior when the basePath OpaqueToken is an empty string versus null. Done means an empty string is accepted rather than replaced by the default basePath.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.