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

Replace Hashie::Mash with ActiveSupport::HashWithIndifferentAccess #1514

Conversation

msroot
Copy link

@msroot msroot commented Oct 28, 2016

This will replace Hashie::Mash with ActiveSupport::HashWithIndifferentAccess

@msroot msroot force-pushed the replace_hashiemash_with_active_supports_hash branch from f4454d7 to eb4276f Compare October 28, 2016 12:56
@msroot msroot force-pushed the replace_hashiemash_with_active_supports_hash branch from eb4276f to 6545207 Compare October 28, 2016 12:57
@@ -285,7 +285,7 @@ class User
requires :file, type: Rack::Multipart::UploadedFile
end
subject.post '/upload' do
params[:file].filename
params[:file][:filename]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is a change in API as only the top keys are with indifferent access?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope! to all sub keys

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dblock
Copy link
Member

dblock commented Oct 30, 2016

This is similar to #1448, but better.

I think we also need to provide a backward compatible way for existing users to return a Hashie::Mash. Here's what I would like the DSL to be:

class API < Grape::API
  # params is a regular Hash
end
class API < Grape::API
   include Grape::Extensions::...::Hashie::Mash
   # params is Hashie::Mash
end
class API < Grape::API
   include Grape::Extensions::...::ActiveSupport::HashWithIndifferentAccess
   # params is HashWithIndifferentAccess
end

You get the idea ...

@msroot
Copy link
Author

msroot commented Oct 31, 2016

@dblock so the default should be Hash and use ActiveSupport::HashWithIndifferentAccess and Hashie::Mash as an extension?

Does the user has to explicitly require the Hashie::Mash gem then or included in grape.gemspec?

@dblock
Copy link
Member

dblock commented Nov 1, 2016

Yes, I think the default should be Hash.

The user should explicitly include hashie in their Gemfile in order to use the extension, and we should not have it in .gemspec anymore. For tests, it should be a development dependency.

@jdurand
Copy link

jdurand commented Feb 23, 2017

@dblock any timeline on merging this?

@dblock
Copy link
Member

dblock commented Feb 24, 2017

This PR won't be merged without the changes I'm asking for above.

@dblock
Copy link
Member

dblock commented Mar 13, 2017

Replaced with #1594.

@dblock dblock closed this Mar 13, 2017
@dblock
Copy link
Member

dblock commented Apr 9, 2017

Please see #1610 as a working end-to-end PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants