OpenAPITools / OpenAPITools/openapi-generator
[BUG] typescript-axios generator ignores additional property basePath
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
The typescript-axios code Generator ignores the additional property 'basePath' (-p basePath=).
openapi-generator version
5.0.0-beta, master branch, rev. c89a5c416d95c18a635ebcca7d683e68b703672d
OpenAPI declaration file content or url
Generation Details
generated-petstore-typescript-axios/base.ts:
export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
But should be with cli-Option -p basePath=/foobar:
export const BASE_PATH = "/foobar".replace(/\/+$/, "");
Steps to reproduce
java -jar openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml --generator-Name typescript-axios -o generated-petstore-typescript-axios -p basePath=foobar
The Generator typescript-angular does respect this additional property:
java -jar openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml --generator-name typescript-angular -o generated-petstore-typescript-angular -p basePath=/foobar
generated-petstore-typescript-angular\api\pet.service.ts:
export class PetService {
protected basePath = '/foobar';
…
}
Related issues/PRs
PR #3601
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the typescript-axios generator, the petstore.yaml URL, and -p basePath=/foobar, then inspect generated-petstore-typescript-axios/base.ts. Compare the result with the typescript-angular output shown in the report. Done means the generated TypeScript Axios client uses the supplied basePath instead of the specification's default URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100