Releases: cerebris/jsonapi-resources
v0.3.1
0.3.0
Fix sort param plus symbol handling [Issue #120] Spaces are now supported
Fixes issues with non "acts as set" associations not returning correct error codes. Now creates routes in order to return a 405 instead of 404.
Fixes issue with associations not using the correct version (namespace) of a resource.
Supports the latest JSON API linkage format.
Updates README section for routing.
JSONAPI RC2b
More changes for JSONAPI RC2 compliance. Since the JSONAPI RC has changed some of these changes will break code built with the v0.2.0 release.
As JSONAPI 1.0 isn't fully locked down there may be more changes. In addition this project may still be missing some changes to be fully compliant with the current draft. Please raise an issue if you find that's the case.
Changes:
- Removes support for Ruby 1.9
- Updates to README
- Allow
{"data":null}
to clear has-one relationship - Fetching multiple resources by ids has been removed
linked
key has been renamedincluded
resource
key has been renamedrelated
- PATCH is now used for updates
- Adds new
records_for
method to allow overriding the process of fetching related resource records - General code cleanup
Bug fixes:
- Routes were being generated wrong for associations
- Fields and includes formats were not being enforced for non underscored keys
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.
v0.1.0
This release adds callbacks to resources
based on ActiveSupport::Callbacks
. See the README for more details.
This release breaks the existing callback scheme for JSONAPI:: OperationsProcessor
. The old callbacks have been replaced with the callback system based on ActiveSupport::Callbacks
.
Conversion should be simple. Here's an example. This:
class ApprovingOperationsProcessor < JSONAPI::ActiveRecordOperationsProcessor
def before_operation(context, operation)
operation.resource_klass.approve_operation(context, operation)
end
end
will need to be converted to this:
class ApprovingOperationsProcessor < JSONAPI::ActiveRecordOperationsProcessor
before_operation :approve_operation
def approve_operation
@operation.resource_klass.approve_operation(@context, @operation)
end
end
A key difference is that the parameters are no longer passed in to the callback. Instead they are accessible as instance variables on the OperationsProcessor
. You also have access to @result
, @results
, and @operations
instance variables.
In addition there are callbacks for the set of operations as well as the individual operations. And all callbacks support before
, after
and around
.