swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[typescript-angular] apiPackage and modelPackage produce invalid index.ts

Open rudym87 opened this issue 6 years ago • 0 comments

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)

rudym87 avatar Feb 11 '20 10:02 rudym87