1
votes

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")
})
@ApiImplicitParams({
        @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

/settings/api/test/{path<.+>

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

1
Can you explain what *path would mean? Is it 0 or more occurrences? - Ron

1 Answers

0
votes

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