mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-22 22:06:43 +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
|
||||
swagger_root = SwaggerRails.config.resolve_swagger_root(request.env)
|
||||
swagger_root.concat('/') unless swagger_root.end_with?('/')
|
||||
|
||||
swagger_filenames = Dir["#{swagger_root}/**/*.json"]
|
||||
|
||||
@discovery_paths = Hash[
|
||||
swagger_filenames.map do |filename|
|
||||
[
|
||||
filename.sub(swagger_root, root_path),
|
||||
filename.sub(swagger_root, root_path.chomp('/')),
|
||||
load_json(filename)["info"]["title"]
|
||||
]
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user