richhollis / swagger-docs

Generates swagger-ui json files for Rails APIs with a simple DSL.
MIT License
750 stars 150 forks source link

not_swagger_resource #104

Closed theog closed 8 years ago

theog commented 9 years ago

When i run: rake swagger:docs the result is : 1.0: 0 processed / 18 skipped

looking deeper into the swagger code i can see that klass.methods.include?(:swagger_config) has not been applied to the controller class in question. I can see that generate_doc has the correct controllers to traverse over e.g.

{:processed=>[], :skipped=> [{:action=>:skipped, :reason=>:empty_path}, {:action=>:skipped, :path=>"api/v1/tokens", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/cache", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/deals", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/locations", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/campaigns", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/members", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/vouchers", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/addresses", :reason=>:klass_not_present}, {:action=>:skipped, :path=>"api/v1/orders", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/nav_items", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/nav_routes", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/auth", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/states", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"api/v1/banners", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"rails/mailers", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"rails/info", :reason=>:not_swagger_resource}, {:action=>:skipped, :path=>"rails/welcome", :reason=>:not_swagger_resource}]}

generator.rb 129: return {action: :skipped, path: path, reason: :not_swagger_resource} if !klass.methods.include?(:swagger_config) or !klass.swagger_config[:controller]

benmort commented 9 years ago

I'm having the same issue. Theog did you find a solution?

arthurbryant commented 9 years ago

I am also having this problem.

alexey commented 9 years ago

me too, guys did u found solution to this ?

theog commented 9 years ago

Unfortunately I did not, have removed swagger for the time being.

arthurbryant commented 9 years ago

I solved with this one

RAILS_ENV=production rake swagger:docs
richhollis commented 8 years ago

This normally happens when there is a config issue. If you can provide an example then I can take a look at that.