swagger-api / swagger-api/swagger-codegen
[typescript-angular] apiPackage and modelPackage produce invalid index.ts
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Using custom values for apiPackage and modelPackage result in an invalid index.ts, since it uses hardcoded values.
Swagger-codegen version
https://generator.swagger.io/
2.4.12
Swagger declaration file content or url
http://petstore.swagger.io/v2/swagger.json
Command line used for generation
curl -X POST "https://generator.swagger.io/api/gen/clients/typescript-angular" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"options\": { \"apiPackage\": \"MyApiPackage\", \"modelPackage\": \"MyModelPackage\" }, \"swaggerUrl\": \"http://petstore.swagger.io/v2/swagger.json\"}"
{
"options": {
"apiPackage": "MyApiPackage",
"modelPackage": "MyModelPackage"
},
"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"
}
Suggest a fix/enhancement
Actual:
export * from './api/api';
export * from './model/models';
export * from './variables';
export * from './configuration';
export * from './api.module';
Desired:
export * from './MyApiPackage/api';
export * from './MyModelPackage/models';
export * from './variables';
export * from './configuration';
export * from './api.module';
Or maybe the real issue is that these options shouldn't be supported at all (see #1516) and shouldn't be in the example code (https://github.com/swagger-api/swagger-codegen/wiki/FAQ#generator-service)
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
Start with the typescript-angular generator using the reported curl request and the custom apiPackage and modelPackage options. Locate the template or entry point that produces index.ts, then compare its exports with the actual generated package paths. Done means the generated index.ts references MyApiPackage and MyModelPackage correctly, or the supported-option behavior is clarified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100