swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.04k stars 6.03k forks source link

[java play framework] not able to generate java-play-framework server stubs #6804

Closed sashank closed 7 years ago

sashank commented 7 years ago
Description

While generating java play framework server stubs , it gives below errors

Swagger-codegen version

2.2.1

Swagger declaration file content or url

NA

Command line used for generation

wget https://oss.sonatype.org/content/repositories/releases/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar

java -jar swagger-codegen-cli-2.2.1.jar 
Available languages: [android, aspnet5, async-scala, cwiki, csharp, cpprest, dart, flash, python-flask, go, groovy, java, jaxrs, jaxrs-cxf, jaxrs-resteasy, jaxrs-spec, inflector, javascript, javascript-closure-angular, jmeter, nancyfx, nodejs-server, objc, perl, php, python, qt5cpp, ruby, scala, scalatra, silex-PHP, sinatra, rails5, slim, spring, dynamic-html, html, html2, swagger, swagger-yaml, swift, tizen, typescript-angular2, typescript-angular, typescript-node, typescript-fetch, akka-scala, CsharpDotNet2, clojure, haskell, lumen, go-server]

Notice that in the above java-play framework is missing

When i run the below i get errors

java -jar swagger-codegen-cli-2.2.1.jar generate -i ../schema/swagger.yaml -l java-play-framework

Exception in thread "main" java.lang.RuntimeException: Can't load config class with name java-play-framework Available: android
aspnet5
async-scala
cwiki
csharp
cpprest
dart
flash
python-flask
go
groovy
java
jaxrs
jaxrs-cxf
jaxrs-resteasy
jaxrs-spec
inflector
javascript
javascript-closure-angular
jmeter
nancyfx
nodejs-server
objc
perl
php
python
qt5cpp
ruby
scala
scalatra
silex-PHP
sinatra
rails5
slim
spring
dynamic-html
html
html2
swagger
swagger-yaml
swift
tizen
typescript-angular2
typescript-angular
typescript-node
typescript-fetch
akka-scala
CsharpDotNet2
clojure
haskell
lumen
go-server

    at io.swagger.codegen.CodegenConfigLoader.forName(CodegenConfigLoader.java:31)
    at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:353)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:221)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:36)
Caused by: java.lang.ClassNotFoundException: java-play-framework
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at io.swagger.codegen.CodegenConfigLoader.forName(CodegenConfigLoader.java:29)
    ... 3 more
Steps to reproduce

mentioned above .

Related issues/PRs
Suggest a fix/enhancement

where as i can generate java play framework code via the Swagger editor !

JFCote commented 7 years ago

Hi! I'm the main contributor to the Java Play Framework generator. If I'm not mistaking, the first version with the generator is 2.3.0. Try getting the latest available version and try again. Thanks

sashank commented 7 years ago

Thanks its working fine in 2.3.0 !