mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-24 23:06:41 +00:00
Handle trailing slashes when building discovery paths
This commit is contained in:
parent
1068e6c7a6
commit
cc90876dfa
@ -9,12 +9,14 @@ module SwaggerRails
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
swagger_root = SwaggerRails.config.resolve_swagger_root(request.env)
|
swagger_root = SwaggerRails.config.resolve_swagger_root(request.env)
|
||||||
|
swagger_root.concat('/') unless swagger_root.end_with?('/')
|
||||||
|
|
||||||
swagger_filenames = Dir["#{swagger_root}/**/*.json"]
|
swagger_filenames = Dir["#{swagger_root}/**/*.json"]
|
||||||
|
|
||||||
@discovery_paths = Hash[
|
@discovery_paths = Hash[
|
||||||
swagger_filenames.map do |filename|
|
swagger_filenames.map do |filename|
|
||||||
[
|
[
|
||||||
filename.sub(swagger_root, root_path),
|
filename.sub(swagger_root, root_path.chomp('/')),
|
||||||
load_json(filename)["info"]["title"]
|
load_json(filename)["info"]["title"]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user