OpenAPITools / OpenAPITools/openapi-generator

[BUG] [Typescript] generation with --global-properties=model produced code that doesn't compile

Open
#7,927 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Using 5.0.0.beta2 when generating code with --global-properties model all models contain import import { HttpFile } from '../http/http'; to file which doesn't exist because api service aren't generated.

When api service are generated, import in models isn't used when model doesn't handle fileUpload.

npx @openapitools/openapi-generator-cli generate -i src/main/resources/swagger/api.yml -g typescript -o src/main/webapp/app/models --global-property models --additional-properties=stringEnums=true -c openapitools.json

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reported OpenAPI Generator CLI command with --global-property models and inspect the generated model imports. Compare generation with and without API services, then verify that models without file uploads do not reference the missing ../http/http file and that the generated TypeScript compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.