Closed dblock closed 11 years ago
@dblock thanks!
isn't strange to assume the default formmater is the JSON formatter? instead of the user defined formatter?
@guilherme I am not sure I understand the question, could you please elaborate? Thx.
i've misunderstand this:
formatter :json, Grape::Formatter::Rabl
it means that the formatter for JSON is Grape::Formatter::Rabl, if its not possible to use it it will fallback to the default.
I was thinking about it would be possible to do something:
formatter :xml, Grape::Formatter::Rabl
In this case the fallback would be the xml default formatter, but it doesnt make any sense.
sorry for taking your time.
This will work with the next release of Grape. We have refactored formatters in order to enable complete control of output by external libraries without having to monkey-patch Grape. This is hopefully a bit cleaner.
The updated syntax is now as follows:
The formatter implementation will fallback to Grape's JSON formatter.
See https://github.com/intridea/grape/issues/44 as well.