Apipie / apipie-rails

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

Resource description inheritance not working #488

Open ysyyork opened 8 years ago

ysyyork commented 8 years ago

I have two controllers inherit from a same parent controller. I add resource_description block in the parent controller but the child controllers can not show these descriptions. I don't know if it's my configuration problem. For configuration, I set controller matcher exactly these three controllers I want to deal with. If I put resource_description block in each of these controllers, it will work correctly.

archfish commented 7 years ago

+1

joaomarceloods commented 7 years ago

+1

lanrion commented 7 years ago

+1

lanrion commented 7 years ago

ENV:

gem 'apipie-rails', '~> 0.3.6'

I fixed it with a concern:

module Concerns
  module ApipieInheritPatch
    extend ActiveSupport::Concern
    included do

      def self._apipie_get_method_params(action_name)
        if !self.superclass.method_defined?(action_name.to_sym)
          super(action_name)
        else
          self.superclass._apipie_get_method_params(action_name)
        end
      end
    end
  end
end

BTW: if we hack _apipie_save_method_params, it can slove the doc page too.

iNecas commented 7 years ago

Would you mind opening a PR for this?

lanrion commented 7 years ago

Ok,I will open a PR to fix it.

itskingori commented 6 years ago

Can anyone guide me on how to use use @lanrion's hack in https://github.com/Apipie/apipie-rails/issues/488#issuecomment-305385998?

lanrion commented 6 years ago

@itskingori include Concerns::ApipieInheritPatch in your controller.

jairud commented 2 years ago

+1

mathieujobin commented 2 years ago

can anyone prepare something solid, with added tests, I can review and release