You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This attempts to normalize all generators to use OS agnostic
File.separator.
It also fixes a bug in some areas in code where we replace "." in full file
output path with File.separator. We should only be modifying directory
names we own, and should avoid modifying anything that can be provided
by a user.
It would probably be better to use Paths.get(…).toString() in all cases.
Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
This attempts to normalize all generators to use OS agnostic
File.separator.
It also cleans up some areas in code where we replace "." in full file
output path with File.separator. We should only be modifying directory
names we own, and should avoid modifying anything that can be provided
by a user.
It would probably be better to use Paths.get(…).toString() in all cases.
* master:
Add links to Patreon account (#1887)
Python AIOHTTP server generator (#1470)
Fix a problem that points to a folder that doesn't exist (#1863)
Python: Update api_doc_example for multiple auth (#1870)
[gradle] Add 4 boolean properties supported by codegenConfigurator (#1881)
To repro #1834, you can use -o some.dir on master and supporting files will write to some.dir while model/apis will write to some/dir. This was all in AbstractJavaCodegen.java. Other files were normalization of File.separator and usually moving parens so we didn't modify the user-specified outputFolder value.
and here are the errors reported by Travis (and other CIs):
[ERROR] Tests run: 520, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 11.875 s <<< FAILURE! - in TestSuite
[ERROR] apiFileFolder(org.openapitools.codegen.java.AbstractJavaCodegenTest) Time elapsed: 0.009 s <<< FAILURE!
java.lang.AssertionError: expected [/User/open.api.tools/source.folder/org/openapitools/codegen/api] but found [/User/open.api.tools/source/folder/org/openapitools/codegen/api]
at org.openapitools.codegen.java.AbstractJavaCodegenTest.apiFileFolder(AbstractJavaCodegenTest.java:167)
[ERROR] apiTestFileFolder(org.openapitools.codegen.java.AbstractJavaCodegenTest) Time elapsed: 0 s <<< FAILURE!
java.lang.AssertionError: expected [/User/open.api.tools/test.folder/org/openapitools/codegen/api] but found [/User/open.api.tools/test/folder/org/openapitools/codegen/api]
at org.openapitools.codegen.java.AbstractJavaCodegenTest.apiTestFileFolder(AbstractJavaCodegenTest.java:176)
[ERROR] modelFileFolder(org.openapitools.codegen.java.AbstractJavaCodegenTest) Time elapsed: 0.001 s <<< FAILURE!
java.lang.AssertionError: expected [/User/open.api.tools/source.folder/org/openapitools/codegen/model] but found [/User/open.api.tools/source/folder/org/openapitools/codegen/model]
at org.openapitools.codegen.java.AbstractJavaCodegenTest.modelFileFolder(AbstractJavaCodegenTest.java:194)
[ERROR] modelTestFileFolder(org.openapitools.codegen.java.AbstractJavaCodegenTest) Time elapsed: 0 s <<< FAILURE!
java.lang.AssertionError: expected [/User/open.api.tools/test.folder/org/openapitools/codegen/model] but found [/User/open.api.tools/test/folder/org/openapitools/codegen/model]
at org.openapitools.codegen.java.AbstractJavaCodegenTest.modelTestFileFolder(AbstractJavaCodegenTest.java:185)
Sorry about that. I merged in master to fix the file conflicts and it introduced another path replacement and groupings ended up shifting during merge.
I'm currently needing to push to remote in order to have tests run, because after evaluating the Guava issue with Android Gradle Plugin, the test suite locks up on my machine.
Last commit should fix the shippable issue for Windows. I have concerns that a user on Windows would never provide a path like /Users/jim/path and require a / replacement to \. Considering / is an invalid path character in Windows I think this is fine from a testing perspective. However, most generators don't do this, so we may want to either update this universally across all generators or do it in DefaultGenerator before using these values.
As mentioned above, and discussed in chat, I've used Paths.get at the point of writing files to cover
normalization of path for all generators.
This resolves an issue, for instance when you do Paths.get("C:/Users/jim/mypath") on Windows in any generator, we expect to write to C:\Users\jim\mypath. This should also handle normalizing filenames with spaces in all operating systems. Using Paths.get will also expose a better exception for invalid path characters, which should help us to track down issues with path characters a little better in the future.
* Clean up file output handling
This attempts to normalize all generators to use OS agnostic
File.separator.
It also cleans up some areas in code where we replace "." in full file
output path with File.separator. We should only be modifying directory
names we own, and should avoid modifying anything that can be provided
by a user.
It would probably be better to use Paths.get(…).toString() in all cases.
* Fix missed path separators in java codegen
* Adjust Java codegen path replacements
* Convert / in full path replacements, as / is forbidden in Windows, and noop elsewhere
* Use Paths.get where files are written, to better handle Windows path constraints
j-fontaine added a commit
to connexta/ion-ingest-api
that referenced
this pull request
Jun 24, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This attempts to normalize all generators to use OS agnostic
File.separator.
It also fixes a bug in some areas in code where we replace "." in full file
output path with File.separator. We should only be modifying directory
names we own, and should avoid modifying anything that can be provided
by a user.
It would probably be better to use Paths.get(…).toString() in all cases.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,. Default:3.4.x,4.0.xmaster.