Skip to content

[Typescript] Import path is invalid in windows.#7175

Merged
macjohnny merged 1 commit intoOpenAPITools:masterfrom
masmgr:fix_issue_7174
Aug 11, 2020
Merged

[Typescript] Import path is invalid in windows.#7175
macjohnny merged 1 commit intoOpenAPITools:masterfrom
masmgr:fix_issue_7174

Conversation

@masmgr
Copy link
Contributor

@masmgr masmgr commented Aug 10, 2020

Fixes #7174. Please review.

Use / instead of File.Separator. File.Separator is / in Windows.

A target method is postProcessOperationsWithModels of openapi-generator\modules\openapi-generator\src\main\java\org\openapitools\codegen\languages\TypeScriptClientCodegen.java.

Before

im.put("filename", ((String) im.get("import")).replace(".", File.Separator));

After

im.put("filename", ((String) im.get("import")).replace(".", "/"));

By this, OpenAPI generator generated valid import path in typescript.

Expected Code

import { Pet } from '../models/Pet';

Actual Code

import { Pet } from '..\models\Pet';

Use `/` instead of `File.Separator`. `File.Separator` is `/` in Windows.
Copy link
Member

@macjohnny macjohnny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@macjohnny macjohnny merged commit 13c94ee into OpenAPITools:master Aug 11, 2020
@macjohnny macjohnny added this to the 5.0.0 milestone Aug 11, 2020
jimschubert added a commit that referenced this pull request Aug 12, 2020
* master: (27 commits)
  [WIP][python-exp] Force camelization of imports (#7186)
  Fixes #6942: Added ability to prepend a basePath to typescript-redux-query generators (#6943)
  [Typescript] Import path is invalid in windows. (#7175)
  Fix JaxRS Spec generator additional model types (#7180)
  [python{,-experimental}] Obey floating point timeouts provided to RESTClientObject.request(...) (#7154)
  [C#] Switch the spec to OAS v3 from v2 (#7176)
  [Javascript] Fixing the handling of non primitive types in paramToString (#7171) (#7172)
  [typescript-node] Fix invalid type when using node@10 and ES5 (#7133)
  Minor fix to github workflow badge
  [gradle] Enabling up-to-date checks and gradle caching for openapigenerator tasks (#6716)
  feat(csharp-netcore): Adding response headers to the ApiException (#7169)
  [ci] Verify supported JDK versions on master push (#7085)
  Issue #6830: Java server - Add getter to ApiException templates (#7150)
  update kotlin samples
  [Kotlin] Make ApiClient in jvm-retrofit2 be able to use own OkHttpClient (#6999)
  Sttp - wrap query params (#6884)
  Add a link to https://medium.com/@everisBrasil blog post (#7160)
  [C#][netcore] fix regular expression when it contains double quotes (#7147)
  remove duplicated cancellationToken in comment (#7148)
  update samples
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][Typescript] Import path is invalid in windows.

2 participants