swagger-play icon indicating copy to clipboard operation
swagger-play copied to clipboard

Problems with String Interpolating Routing DSL

Open MatteCarra opened this issue 7 years ago • 5 comments

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 avatar Aug 09 '17 14:08 MatteCarra

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.

MatteCarra avatar Aug 09 '17 19:08 MatteCarra

@MatteCarra I think its probably related to #150

softinio avatar Aug 17 '17 00:08 softinio

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.

vijaykramesh avatar Dec 30 '17 00:12 vijaykramesh

Is there any update on this issue?

PaulX-CN avatar Aug 24 '18 15:08 PaulX-CN

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.

gmethvin avatar Sep 07 '18 06:09 gmethvin