AKA Almost 1.0
This marks the last general release before we release 1.0
π π π
The API should be considered stable and public. Basically, it shouldn't change after this release. The notable changes are:
These changes are backwards-incompatible π₯
Serializer#attributes
was renamed toSerializer#serialized
. See commit.- The rack helper is now called
#granola
. So in Cuba you'd do:halt granola(current_user, with: SessionSerializer)
, for example. Thanks @djanowski for the idea π See commit. Granola::Rack
no longer cares about checking freshness of a response. Instead, it makes the body defer to the call to each before actually calling#to_json
. This means that you can put Rack::ConditionalGet in the middleware stack and use that to make the response304
to clients. See commit.
These are backwards-compatible π
- Allow passing default headers to the rack helper. Thank @lucasefe for this one π. See commit.
- Don't hate so much on MultiJson β€οΈ As @luislavena put it, the performance problems alluded to in v0.0.4 have been fixed. We still default to our own way of configuring the JSON backend, but if MultiJson is available then we use that. See commit.
- Open the road for multiple formats (such as serializing to YAML or MsgPack right from Granola). The rack helper now includes an
as:
keyword that specifies the format to render (defaults to:json
). As long as you defineSerializer::MIME_TYPES[format]
and a#to_#{format}
method in your serializers, then you can justgranola(object, as: <format>)
. See commit
Thanks to everyone who offered suggestions and feedback for making this possible. I π you.