JSONAPI RC2
This is a big set of changes that start to bring JSONAPI-Resources into compliance with JSONAPI RC2. There a many breaking changes from the v0.1.1 release, and it may not be prudent to use this release unless you are looking to test out the new JSON API RC2. There are still a few outstanding areas where we are not up to the spec, and future releases will be coming soon.
I'm not going to document the format changes here that needed to take place to meet the new spec, since those are spelled out in the JSONAPI update. Below are the major new features, besides formatting, that have been added:
- Pagination has been added through the use of Paginators. Two paginators have been provided to support offset and paged pagination. Custom paginators can also be created.
- Sorting has been changed to use the required direction (
+
or-
). This led to a minor rework of the sort logic. - Serializer options are now provided in the initializer and the serialization methods simply provide the objects to serialize. This allowed for dryer code between the new
serialize_to_links_hash
andserialize_to_hash
methods. The controller is also, I hope, a bit clearer since this has been separated. - Serializer now emits generated urls for associations and associated resources, based on a base url. This assumes the creation of routes for each related resource in the primary resource's namespace.
CreateHasOneAssociationOperation
operation has been removed along withcreate_has_one_link
resource method.- Request parsing has been cleaned up. Now makes more use of Strong Parameters (still more work to go though).
id
andids
special handling inrequest
has been removed.- Related resources may now be fetched. This has new routes and controller methods.