Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response format is not deeply included in modules #965

Closed
hodak opened this issue Mar 23, 2015 · 3 comments
Closed

Response format is not deeply included in modules #965

hodak opened this issue Mar 23, 2015 · 3 comments
Labels

Comments

@hodak
Copy link
Contributor

hodak commented Mar 23, 2015

Hi, I have two APIs defined: api/main and api/admin. I use module Defaults to include settings and helpers for both. It looks like this:

module API
  module Defaults
    extend ActiveSupport::Concern
    included do
      format :json

      ...
    end
  end
end

module API
  module Main
    module Defaults
      extend ActiveSupport::Concern
      include API::Defaults

      included do
        ...
      end
    end
  end
end

module API
  module Main
    class Users < Grape::API
      include API::Main::Defaults
    end
  end
end

It worked well before updating 0.10.0 which closed #809

My endpoints stopped working because no format :json was defined even though it includes module that defines the format. It starts working after defining format :json explicitly in API::Main::Defaults and API::Main::Admin.

Is this expected behavior?

@dblock
Copy link
Member

dblock commented Mar 24, 2015

I think this is a bug, but I am not 100% sure. It seems that you should be bringing in everything, including the format - you should write a test that reproduces it to start.

@hodak
Copy link
Contributor Author

hodak commented Apr 26, 2015

Hi, sorry for taking such a long time. I've created PR and explained it there: #1001

@hodak
Copy link
Contributor Author

hodak commented Apr 27, 2015

Pull request has been merged, closing.

@hodak hodak closed this as completed Apr 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants