Error opening a file after update to 1.5.0
cbisio opened this issue · 3 comments
After updating to 1.5.0, it started throwing this error:
Error: Error opening file "/home/runner/work/api/api/swagger_doc.json"
ENOENT: no such file or directory, open '/home/runner/work/api/api/swagger_doc.json'
Rolling back to previous version
please can you describe a bit more what happens, so one can reprocude it, ideally writing a spec with the bad behaviour, thanks
I simply can't run any spec because it throws the error above
Had a similar problem related to swagger doc generation https://github.com/ruby-grape/grape-swagger#openapiswagger-documentation
Due to the changes https://github.com/ruby-grape/grape-swagger/pull/846/files#diff-858484a86a433201a2b47c90554864d3b2a97ceb23e28fe5d80662231a3ac9afR118 now all the generated files are appended with the version for their names.
def file(url)
api_version = url.split('/').last
name = if ENV['store'] == 'true' || ENV['store'].blank?
"swagger_doc_#{api_version}.json"
else
ENV['store'].sub('.json', "_#{api_version}.json")
end
File.join(Dir.getwd, name)
end
Then:
store=true
=> "swagger_doc.json"
store=custom_file_name.json
=> "custom_file_name.json"
Now:
store=true
=> "swagger_doc_swagger_doc.json"
store=custom_file_name.json
=> "custom_file_name_swagger_doc.json"
For our setup, the api_version
is evaluated as "swagger_doc". But I believe we should have had an empty line instead, cause we don't have an API versioning.
# url = "/swagger_doc" (by default)
#
api_version = url.split('/').last
=> "swagger_doc"