akhabaiev akhabaiev - 9 months ago 56
Java Question

Swagger UI and Play routing *path

I'm having trouble with Swagger understanding Play! 2.0 routing wildcard routing, so the swagger ui ends up with broken URL.
My routes file has this route:

GET /settings/api/:project/*path @controllers.API.getParams(project, path)

Then my Controller has the following code:

@ApiOperation(value = "Returns settings for given project and path.", response = String.class, httpMethod = "GET")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Request completed successfully."),
@ApiResponse(code = 500, message = "Internal error while processing request")
@ApiImplicitParam(name = "project", value = "Project name", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "path", value = "path", required = true, dataType = "String", paramType = "path")
public Result getParams(String project, String path) {
return ok(path);

Then when Swagger UI gets rendered, I see the path for this action rendered as

POST /settings/api/{project}/{path<.+>

And when I do a call it turns into


So basically the :project gets replaced but the *path remains broken/intact.
Please share if you know how to fix this. Thanks!

Answer Source

So turns out that swagger doesn't support wildcard routes.