swagger-api / swagger-play

Apache License 2.0
330 stars 180 forks source link

Problems with String Interpolating Routing DSL #152

Open MatteCarra opened 7 years ago

MatteCarra commented 7 years ago

Play Swagger isn't working at all with String Interpolating Routing DSL

I think that the problem is related to the fact that routes structured like this -> /my/route link to java files and not to other routes.

If you want to reproduce the bug quickly you can try with this repo: https://github.com/playframework/play-scala-rest-api-example/tree/2.6.x

Here you the exception:

Caused by: java.lang.NullPointerException: null at java.io.Reader.(Reader.java:78) at java.io.InputStreamReader.(InputStreamReader.java:129) at scala.io.BufferedSource.reader(BufferedSource.scala:22) at scala.io.BufferedSource.bufferedReader(BufferedSource.scala:23) at scala.io.BufferedSource.charReader$lzycompute(BufferedSource.scala:33) at scala.io.BufferedSource.charReader(BufferedSource.scala:31) at scala.io.BufferedSource.scala$io$BufferedSource$$decachedReader(BufferedSource.scala:60) at scala.io.BufferedSource.mkString(BufferedSource.scala:89) at play.modules.swagger.SwaggerPluginImpl.play$modules$swagger$SwaggerPluginImpl$$parseRoutesHelper$1(SwaggerPlugin.scala:122) at play.modules.swagger.SwaggerPluginImpl$$anonfun$1.applyOrElse(SwaggerPlugin.scala:131)

MatteCarra commented 7 years ago

I was trying to create a pull request but I've just realized how difficult it is to fix this issue. As long as I know there's no way to extract any information from SimpleRouter because it only contains a PartialFunction.

softinio commented 7 years ago

@MatteCarra I think its probably related to #150

vijaykramesh commented 6 years ago

I think I'm experiencing this same issue on 2.5.18, see https://github.com/swagger-api/swagger-play/issues/110#issuecomment-354505863

Edit: confirmed, when I switch to only using a routes file everything works.

PaulX-CN commented 6 years ago

Is there any update on this issue?

gmethvin commented 6 years ago

It's relatively difficult to extract the path information from SIRD. In our fork we fixed the NPE so it just ignores the SIRD router.