v2.0.0
Breaking Changes
- Add
context
to the methods resolving the ETag, Location and Media Controls, because in some complex cases it's needed to pass additional information. - Added
RESTfulControllerResourceCreationPolicy
hierarchy. Every controller now has to define which policy must be used on resource creation between these two:RESTfulControllerDoNotRespondCreatedEntityPolicy
to return an empty body.RESTfulControllerRespondCreatedEntityPolicy
to return a representation of the resource in the response body.
- Added Hyperspace as a dependency and migrated all uses of
HTTPClientError
. Now you can handle instances likeHTTPClientError notFound
orHTTPClientError conflict
.
Non Breaking Changes
- Include "ETag" header when a POST request is responded including a representation
- Respond with Bad Request when the pagination cannot be correctly created from the parameters
- Added protocol to easily generate vendor media types.
- Canonical API tests now lookup for a free port.
- Add some utilities to ZnUrl for pagination and query parameters including URLs
- Add some utility methods to ResourceRESTfulControllerTest improving PATCH usage
Migration Notes
Some changes can be automatically migrated from v1
:
- Load manually the package
Stargate-MigrationTo2
- It will include deprecations including automatic rewrite expressions, so if you exercise the code it will get converted to the new versions.
Other changes cannot be migrated in an automated fashion, but are easy to do:
- Subclasses of
ResourceRESTfulController
must contemplate the following changes:entityTagOf:encodedAs:
is nowentityTagOf:encodedAs:within:
and receives the context as argumentlocationOf:
is nowlocationOf:within:
and receives the context as argumentmediaControlsFor:
is nowmediaControlsFor:within:
and receives the context as argumentprovideResourceCreationPolicy
is now a subclass responsibility
For the methods including the new argument, you can use your old implementation and ignore the context argument (Just change the method signature). For the remaining subclassResponsibility implement it as:
provideResourceCreationPolicy
^ RESTfulControllerDoNotRespondCreatedEntityPolicy for: self