Apipie / apipie-rails

Ruby on Rails API documentation tool
Apache License 2.0
2.47k stars 463 forks source link

api! not discovering routes (rails 5.1.4, apipie-rails 0.5.6) #592

Open stevenleeg opened 6 years ago

stevenleeg commented 6 years ago

Hi there,

Just installed apipie and noticed that api! isn't discovering routes properly. Browsing through old issues it looks like this has been an issue in the past, so I'm not quite sure if I haven't set it up properly or if the bug has resurfaced since I'm using a new project with the latest Rails (5.1.4) and apiepie-rails (0.5.6).

Here is my controller:

module V1
  class FilesController < ApplicationController
    resource_description do
      short 'Client files'
    end

    api! 'Uploads a file to a client repository'
    param :file, Hash, required: true do
      param :name, String, 'The filename'
    end
    def create
    end
  end
end

And the output:

captura de pantalla 2018-01-11 a las 23 18 12

Any idea as to what could be going awry? Thanks!

stevenleeg commented 6 years ago

Also something very bizarre that I just noticed: restarting the Rails server will generate the route properly on the first load of /apipie:

captura de pantalla 2018-01-11 a las 23 20 22

but refreshing the page (and each subsequent refresh) causes it to go back to being blank (as in the screenshot above).

sordina commented 6 years ago

@stevenleeg there seem to be a few issues here. I've had success with making api! discover routes if I've turned off the config.reload_controllers setting. Weird I know. But then the json representation is still missing the api! routes, so the problem is definitely deeper than just that.

bernica commented 6 years ago

I'm experiencing the same issue, Rails 5.1.2, apipie-rails 0.5.6.

stevenleeg commented 6 years ago

@sordina Huh, I've actually added config.reload_controller = false to my config and it hasn't helped me out any. I haven't had much time to dig deeper into the problem unfortunately, but if anyone needs any more information about my environment to debug just let me know.

ndtelles commented 6 years ago

I have the same issue, Rails 5.1.4 and apipie-rails 0.5.6. I also get the weird issue where the route only appears the first time you load the page. Turning off reload_controller fixes it for me.

stevenallen05 commented 6 years ago

Same issue with Rails 5.2.0 and apipie-rails 0.5.7 when generating static HTML docs.

OAuthBringer commented 6 years ago

Confirmed with Rails 5.0.1 with api-rails 0.5.7

0.5.4 raises a 500 0.5.5 raises a 500 0.5.6 raises a 500 0.5.7 returns 200, has a section for the controller, but lists no resources or descriptions 0.5.7 also seems to maintain the rendered empty section even after api! has been removed from the method.

heyfadii commented 6 years ago

Is this going to be fixed any time soon?

shaffan-chaudhry-s63 commented 6 years ago

Having same issue with rails 5.2.0 and apipie 0.5.10

stefatkins commented 6 years ago

Just installed apipie v 0.5.10 and having the same issue with rails 5.2.0

nusken commented 6 years ago

Confirm api! (v 0.5.10) does not work with rails 5.2.1