Open respire opened 4 years ago
@respire I was able to reproduce this bug when I switched to using versioned apis. It looks like adding versions with different base_urls caused it: Reproduces bug:
config.api_base_url = ""
config.api_base_url["unstable"] = ""
config.api_base_url["v1"] = "/api/v1"
config.default_version = "v1"
Fix:
config.api_base_url = ""
config.api_base_url["unstable"] = ""
config.api_base_url["v1"] = ""
config.default_version = "v1"
I also had to add back the prefix /api/v1
to all my routes in my "v1" controllers.
Bad: api :GET, '/stuff', 'List of Stuff'
Good: api :GET, '/api/v1/stuff', 'List of Stuff'
It seems like multiple versions/base_urls are not well supported.
The real fix would be to fix the writer.rb
class in apipie and move the lines 66-68 above the protected
line. Though I think the root cause is that Apipie is not properly handling the base url correctly and thus causing the warnings in the first place.
Environment:
Step to reproduce
append this line in test_helper.rb
Apipie.record('params')
and then run functional tests
Expected
write doc without error
Actual
an exception raised
protected method `logger' called for Apipie::Extractor::Writer:Class (NoMethodError)
Full log