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

Custom template in openapi 3 doesnt work always throws java.io.FileNotFoundException: /C:\user\template/C:\user\template\model.mustache #8132

Closed
anand188 opened this issue May 3, 2018 · 15 comments

Comments

@anand188
Copy link

anand188 commented May 3, 2018

Exception in thread "Thread-1" java.lang.RuntimeException: Could not generate model 'AllLinks'
at io.swagger.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:407)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:722)
at io.swagger.codegen.cmd.Generate.run(Generate.java:312)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: /C:\user\template/C:\user\template\model.mustache
at com.github.jknack.handlebars.io.URLTemplateLoader.sourceAt(URLTemplateLoader.java:70)
at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:357)
at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:343)
at io.swagger.codegen.DefaultGenerator.getHandlebars(DefaultGenerator.java:1017)
at io.swagger.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:738)
at io.swagger.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:394)

@anand188
Copy link
Author

anand188 commented May 3, 2018

@HugoMario is there any latest jar published resolves this issue

@anand188 anand188 mentioned this issue May 4, 2018
4 tasks
@robert2411
Copy link

C:\user\template/C:\user\template\model.mustache
i see 2 times the beginning of the path in here are you sure your path is set correctly

@anand188
Copy link
Author

anand188 commented May 9, 2018

@robert2411 The pom.xml has the below
c:/user/template which causes this issue

@anand188
Copy link
Author

anand188 commented May 9, 2018

@robert2411 Please take a look ,review the Fix issue8132 #8140 to solve the same

@HugoMario
Copy link
Contributor

Hello @anand188, sorry for this really late response, i'm wondering if you got this issue trying with latest changes on 3.0.0-SNAPSHOT branch

@anand188
Copy link
Author

@HugoMario 3.0.0-SNAPSHOT do you refer to pom.xml ?
io.swagger
swagger-codegen-maven-plugin
3.0.0-rc0

Above only i am using which doesn't work

@anand188
Copy link
Author

@HugoMario 3.0.0-SNAPSHOT also you specify it as branch i only see 3.0.0 branch .
If any branch regarding snapshot is there ?

@HugoMario
Copy link
Contributor

hey @anand188, sorry about it, yea it was my bad. The branch is 3.0.0 and that's where codegen 3.0.0-SNAPSHOT is placed.

@anand188
Copy link
Author

@HugoMario i tested the same now it was not working i am working in windows .
whats your OS? and is code tested in all OS?

@HugoMario
Copy link
Contributor

@anand188 can you please share the command you're using?

@anand188
Copy link
Author

@HugoMario the below is the command i used
java -jar swagger-codegen-cli-3.0.0-SNAPSHOT.jar generate -i authorization.yaml -l jaxrs-jersey -c config.json -t C:\anand\template

@HugoMario
Copy link
Contributor

ok, FYI checking in a windows in a bit

@bigtlb
Copy link

bigtlb commented May 24, 2018

I am also having issues with the template option in Windows.

If I use forward slashes in the path, I get File Not Found and duplicated part of the path (like above). If I use backslashes, like:

-t C:\Users\mrtlb\template

I get:

Caused by: java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 3
C:\Users\mrtlb\template
  ^

@HugoMario
Copy link
Contributor

This isse has been fixed by #8284 and #8246

@OnkelTem
Copy link

Now it doesn't work on Linux too. But the reason is different.

#10107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants