Skip to content

[BUG][typescript-fetch] api model imports not using correct filename #23840

@celluj34

Description

@celluj34

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Using the typescript-fetch generator, if you set additionalProperties.fileNaming = kebab-case, then any API tries to import the required models using the default PascalCase instead of the correct filename of kebab-case.

openapi-generator version

7.22. I am not sure if it's a regression as imports were using barrel imports before.

OpenAPI declaration file content or url
{
  "$schema": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/master/apps/generator-cli/src/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "7.22.0",
    "generators": {
      "myApi": {
        "inputSpec": "https://localhost:5001/openapi/v1.json",
        "output": "src/api-client/myApi",
        "generatorName": "typescript-fetch",
        "enablePostProcessFile": true,
        "additionalProperties": {
          "fileNaming": "kebab-case",
          "stringEnums": true,
          "supportsES6": true,
          "strictSpec": true
        },
        "globalProperty": {
          "supportingFiles": "",
          "models": "",
          "apis": "MyApi1"
        }
      }
    }
  }
}
Generation Details
Steps to reproduce
  • using the above openapitools.json, run openapi-generator-cli generate.
  • inspect any api.ts file, and see that it's using incorrect file import paths
Related issues/PRs
Suggest a fix

typescript-angular does not have this problem. they are using the operations array instead of the import array to import models.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions