Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8415
Closed
Open
Issue created Jan 12, 2021 by Administrator@rootContributor

[BUG][typescript-angular] The ApiInterface import statement for the Configuration doesn't take use the configurationPrefix option

Created by: Thessi

Description

This issue occurs when both the configurationPrefix and the withInterfaces options are used. While the Configuration field in the interface correctly uses the configurationPrefix, the import for the Configuration tries to import Configuration, which leads to an error.

From https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-angular/apiInterface.mustache

...
import { Configuration }                                     from '../configuration';
...
configuration: {{configurationClassName}};
...

In https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache , the import is already correct, so the used class name and the import name match up. This should also be done in the apiInterface

openapi-generator version

5.0.0

Generation Details

minimal maven configuration:

<configuration>
    ...
    <generatorName>typescript-angular</generatorName>
    <configOptions>
        <withInterfaces>true</withInterfaces>
        <configurationPrefix>Api</configurationPrefix>
    </configOptions>
</configuration>
Suggest a fix

Adjust the import statement here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-angular/apiInterface.mustache#L11

The correct import statement would be: import { {{configurationClassName}} } from '../configuration';

Assignee
Assign to
Time tracking