Open seantbrady opened 12 years ago
On second review, my port is a bit naive at the moment. I'm going to take a deeper look.
Upon further investigation, I found that the swagger-play2 module is limited to the Play Scala API. I have started working on porting the entire module (not just the sample app) to Java. At this point, I am blocked by a compilation issue when trying to implement/extend ApiSpecParserTrait. I'm wondering if it makes sense to keep one copy of the swagger-play2 module (written in Scala) and ensure that code is Java-friendly.
Here are some trouble spots I know of: 1) ApiHelpInventory.scala line 140 tests for play.api.mvc.Controller. The Java api is play.mvc.Controller 2) PlayApiReader.scala lines 62 & 99 may be depending on Scala syntax for method names.
Moved Java version of module to swagger-play2-java branch.
/resources.json works: { apiVersion: "beta", swaggerVersion: "1.0", basePath: "http://localhost", apis: [ { path: "/pet.{format}", description: "Operations about pets" } ] }
However, /pet.json causes a NullPointerException: play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NullPointerException: null]] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:82) [play_2.9.1.jar:2.0] at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:63) [play_2.9.1.jar:2.0] at akka.actor.Actor$class.apply(Actor.scala:290) [akka-actor.jar:2.0] at play.core.ActionInvoker.apply(Invoker.scala:61) [play_2.9.1.jar:2.0] at akka.actor.ActorCell.invoke(ActorCell.scala:617) [akka-actor.jar:2.0] at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:179) [akka-actor.jar:2.0] Caused by: java.lang.NullPointerException: null at controllers.SwaggerBaseApiController.JsonResponse(ApiHelpController.scala:73) ~[swagger-play2_2.9.1.jar:1.1-SNAPSHOT] at controllers.SwaggerBaseApiController.returnValue(ApiHelpController.scala:67) ~[swagger-play2_2.9.1.jar:1.1-SNAPSHOT] at controllers.ApiHelpController$$anonfun$getResource$1.apply(ApiHelpController.scala:43) ~[swagger-play2_2.9.1.jar:1.1-SNAPSHOT] at controllers.ApiHelpController$$anonfun$getResource$1.apply(ApiHelpController.scala:40) ~[swagger-play2_2.9.1.jar:1.1-SNAPSHOT] at play.api.mvc.Action$$anon$1.apply(Action.scala:170) ~[play_2.9.1.jar:2.0] at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$4.apply(Invoker.scala:74) ~[play_2.9.1.jar:2.0]