OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.82k stars 6.58k forks source link

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

Open agilob opened 4 years ago

agilob commented 4 years ago

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

agilob commented 4 years ago

Introduced here https://github.com/OpenAPITools/openapi-generator/pull/6341/files#diff-57bb0a59844373866a5460a420920f518ee8ff5d743f257da0b0abede9104bb9R7

macjohnny commented 3 years ago

@agilob would you like to fix this?

agilob commented 3 years ago

I tried for a short moment, thought it would quick and simple fix, but I failed on it. It's not bugging me any more as typescript-angular generates correct models, so simply I moved to typescript-angular generator.

Or-Zarchi-Forter commented 2 years ago

any update on this? the typescript generator can't be used if only model generation is required

macjohnny commented 2 years ago

@Or-Zarchi-Forter you are welcome to implement a fix. As a workaround, you can also post-process the generated files and remove those imports