Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java][groovy] Fix mangled src paths in some outputs on Windows #7487

Merged
merged 1 commit into from
Sep 23, 2020

Conversation

jimschubert
Copy link
Member

Fixes #7434

When generating on Windows, some outputs may look like:

 main.java.srcDirs = ['src/main\java']

That's wrong and this fixes the issue. Common strings like src/main/java shouldn't be treated like a path; if it's used to write files then it's the responsibility of the template manager, if it's used in Gradle outputs then it's Gradle's responsibility to normalize the path for the given OS.

cc @OpenAPITools/generator-core-team

cc java technical committee
@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @bkabrda

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@auto-labeler
Copy link

auto-labeler bot commented Sep 23, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

}

@Test
public void toModelNameUsesPascalCase() throws Exception {
Assert.assertEquals("JsonAnotherclass", fakeJavaCodegen.toModelName("json_anotherclass"));
Assert.assertEquals(fakeJavaCodegen.toModelName("json_anotherclass"), "JsonAnotherclass");
Copy link
Member Author

Choose a reason for hiding this comment

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

All above changes are minor cleanup. The assertions weren't in (actual, expected) format, which could lead to confusion on build failures.

@jimschubert jimschubert merged commit 1716ee3 into OpenAPITools:master Sep 23, 2020
@jimschubert jimschubert deleted the fix-java-src-paths branch September 23, 2020 04:03
jimschubert added a commit to Marvin1912/openapi-generator that referenced this pull request Sep 25, 2020
* master: (1357 commits)
  minor formatting change (OpenAPITools#7503)
  [ruby] Fix generation when generateAliasAsModel is enabled (OpenAPITools#7419)
  [sonar][ci] Fixes some new recommended "bug" fixes found via Sonar (OpenAPITools#7508)
  Add option to set recursion limit (OpenAPITools#7491)
  regenerate java pkmst petstore samples (OpenAPITools#7502)
  fix issue without http signature auth (OpenAPITools#7504)
  [ruby] Support for per-operation servers (OpenAPITools#7415)
  Add a link to react native tutorial (OpenAPITools#7505)
  update of Objective-C model-body.mustache to support discriminator.mappedModels (OpenAPITools#7471)
  update samples
  [ci] Sonar bug fixes (OpenAPITools#7497)
  fixed the backslash issue (OpenAPITools#7492)
  Fix the range check condition (OpenAPITools#7482)
  [batch] Option to clean files before generation (OpenAPITools#7465)
  [java][groovy] Fix mangled src paths in outputs on Windows (OpenAPITools#7487)
  remove haskell stack installation in shippable ci (OpenAPITools#7481)
  remove hardcoded PetApi (OpenAPITools#7483)
  remove SWGApiResponse.m (not used) (OpenAPITools#7478)
  update samples
  [typescript-axios] support "x-enum-descriptions" (OpenAPITools#7477)
  ...
jimschubert added a commit to jimschubert/openapi-generator that referenced this pull request Sep 25, 2020
* master: (2170 commits)
  [ci][test] Fix samples (OpenAPITools#7509)
  [bug][Java] Honor instantiationMap for default values for array, map, set (OpenAPITools#4982)
  Fix stringifying of ~= (OpenAPITools#7460)
  minor formatting change (OpenAPITools#7503)
  [ruby] Fix generation when generateAliasAsModel is enabled (OpenAPITools#7419)
  [sonar][ci] Fixes some new recommended "bug" fixes found via Sonar (OpenAPITools#7508)
  Add option to set recursion limit (OpenAPITools#7491)
  regenerate java pkmst petstore samples (OpenAPITools#7502)
  fix issue without http signature auth (OpenAPITools#7504)
  [ruby] Support for per-operation servers (OpenAPITools#7415)
  Add a link to react native tutorial (OpenAPITools#7505)
  update of Objective-C model-body.mustache to support discriminator.mappedModels (OpenAPITools#7471)
  update samples
  [ci] Sonar bug fixes (OpenAPITools#7497)
  fixed the backslash issue (OpenAPITools#7492)
  Fix the range check condition (OpenAPITools#7482)
  [batch] Option to clean files before generation (OpenAPITools#7465)
  [java][groovy] Fix mangled src paths in outputs on Windows (OpenAPITools#7487)
  remove haskell stack installation in shippable ci (OpenAPITools#7481)
  remove hardcoded PetApi (OpenAPITools#7483)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant