-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add register keyword for adding customized parsers and formatters #1330
Add register keyword for adding customized parsers and formatters #1330
Conversation
2534984
to
7fdded0
Compare
I see how a require fixes this, but we now load formatters we don't use. Why doesn't autoload work with grape-msgpack? |
Nope, I removed |
Sorry, I am a little slow, and clearly I am missing some Ruby-fu understanding :) Why doesn't it work with grape-msgpack? |
At first, I think we should be able to provide more developer-friendly interface. |
What if we just added a global interface to register formatters, instead of inheriting anything? Like so: Grape.configure do |config|
config.formatters.add
end |
Or class MyFormatter << Grape::Formatter
end
Grape::Formatter.register MyFormatter, ... |
Yeah, it's so cool and developer-friendly. :) 2016年3月17日木曜日、Daniel Doubrovkine (dB.) @dblockdotorg<
|
Hmm, right. It's reasonable. 2016年3月17日木曜日、Daniel Doubrovkine (dB.) @dblockdotorg<
|
I don't think we should backport anything and just move forward. If you want to give one of the above a short, go for it! I'd rather not remove autoload. I prefer the second version btw, not the global configuration one because that always bites us. |
I am planning to write micro service using ruby-grape, So I am thinking 0.15.0 is stable version to use. Plz lemme know your suggestions. |
7fdded0
to
f96b732
Compare
I've tried to implement |
@@ -11,6 +11,7 @@ | |||
|
|||
* [#1325](https://github.com/ruby-grape/grape/pull/1325): Params: Fix coerce_with helper with Array types - [@ngonzalez](https://github.com/ngonzalez). | |||
* [#1326](https://github.com/ruby-grape/grape/pull/1326): Fix wrong behavior for OPTIONS and HEAD requests with catch-all - [@ekampp](https://github.com/ekampp), [@namusyaka](https://github.com/namusyaka). | |||
* [#1330](https://github.com/ruby-grape/grape/pull/1330): Fix built-in parsers and formatters - [@namusyaka](https://github.com/namusyaka). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear what's being fixed. The built in parsers and formatters weren't broken really.
I'll merge this as is, feel free to make further changes later. Also I think we don't need to document this publicly for now. |
…tters Fix built-in parsers and formatters
Add a similar spec for parsers. |
ref 93e6998 #1329
I'd like to use grape-msgpack without tricky hacking. Currently, our implementation does not support inheritable interface, so I fixed a few points.
Thoughts?