Open ShokuninSan opened 7 years ago
It could work when I set swagger.api.basepath
in application.conf
to /foo
only, but in this case the implementation of PlayReader.getPathFromRoute
removes the foo
which must remain in the operationPath
as it is not part of the basepath.
Thus instead of
@ val s = "/api/foo/v1/registrations/members"
s: String = "/api/foo/v1/registrations/members"
@ s.replaceFirst("foo", "")
as it is done in PlayReader.java#L232 and which results in
res7: String = "/api//v1/registrations/members"
the method could do
@ s.replace("^foo", "")
res8: String = "/api/foo/v1/registrations/members"
i.e. use replace
and prefix the basePath
parameter with a ^
to avoid removing substrings matching basePath
unintenionally.
Any news on the issue?
I found a dirty workaround by configuring swagger.api.basepath = "/foo/./"
in application.conf.
versions: playframework 2.5.9 swagger-play2 1.5.3
application.conf:
routes (application context and api realm are both intentionally named „foo", so this is no mistake):
result: operation URL returned in spec is
http://0.0.0.0/foo/api/api/foo/v1/registrations/members
where I actually expect this:http://0.0.0.0/foo/api/foo/v1/registrations/members
.I think the reason ist that
PlayReader.getPathFromRoute(PathPattern pathPattern, String basePath)
should actually remove thebasePath
from thepathPattern
in line 232, but it fails to do so, because thepathPattern
does not include theplay.http.context
.Is there a way to overcome this issue?