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

Fix a problem that points to a folder that doesn't exist #1863

Merged
merged 4 commits into from
Jan 11, 2019

Conversation

ackintosh
Copy link
Contributor

@ackintosh ackintosh commented Jan 9, 2019

PR checklist

  • Read the contribution guidelines.
  • 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.

Description of the PR

When working directory contains . , we can see following error:

$ pwd
/Users/akihito.nakano/src/github.com/ackintosh/openapi-generator-1/
$ ./bin/java-petstore-feign.sh
[main] INFO  o.o.codegen.AbstractGenerator - writing file /Users/akihito/nakano/src/github/com/ackintosh/openapi-generator-1/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java
Exception in thread "main" java.lang.RuntimeException: Could not generate model 'AdditionalPropertiesClass'
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:509)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:904)
        at org.openapitools.codegen.cmd.Generate.run(Generate.java:354)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
Caused by: java.io.FileNotFoundException: /Users/akihito/nakano/src/github/com/ackintosh/openapi-generator-1/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java (No such file or directory)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.openapitools.codegen.AbstractGenerator.writeToFile(AbstractGenerator.java:49)
        at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:946)
        at org.openapitools.codegen.DefaultGenerator.generateModel(DefaultGenerator.java:322)
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:498)
        ... 3 more
mkdir: samples/client/petstore/java/feign/src/test/java/org/openapitools/client: File exists

Caused by: java.io.FileNotFoundException: /Users/akihito/nakano/src/github/com/ackintosh/openapi-generator-1/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java (No such file or directory)

The output points to invalid folder, the dots in the folder path has replaced with slash. 🙄

@ackintosh ackintosh added this to the 4.0.0 milestone Jan 9, 2019
./bin/utils/ensure-up-to-date
@ackintosh
Copy link
Contributor Author

cc @bbdouglas (2017/07) @JFCote (2017/08) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01)

Copy link
Member

@wing328 wing328 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, which looks good to me.

@wing328 wing328 merged commit 4652023 into OpenAPITools:master Jan 11, 2019
@ackintosh ackintosh deleted the fix-javaclient-output-folder branch January 12, 2019 00:48
jimschubert added a commit that referenced this pull request Jan 12, 2019
* 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)
@jimschubert
Copy link
Member

also related to #1834

A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
…s#1863)

* Add test case that reproduce issues

* Fix a problem that points to a folder that doesn't exist

* Improves for windows

* Run ensure-up-to-date script

./bin/utils/ensure-up-to-date
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.

3 participants