A liberator mixin to add HAL support to liberator.
application/hal+jsonas a supported media type.
- Adds support for JSON serialisation for maps and seqs for the HAL media type.
- Adds support for halboy resource serialisation.
- Adds a default handler responding with an empty HAL resource for
- Adds a HAL error representation for use with the validation mixin.
- the validation mixin.
The JSON serialisation support for the
application/hal+json media type uses the same underlying JSON encoder as the JSON mixin. If that mixin is configured with a custom JSON encoder, all
application/hal+json responses will use the custom JSON encoder.
The halboy resource support will add a
:discovery link to any returned resource and expects
:routes to be available in the
context, containing a route named
:discovery. The hypermedia mixin adds routes to the
context so nothing further is needed if that mixin is in use.
The HAL media type string.
Returns a mixin which adds a generic exception handler, logging the exception and returning an error representation masking the exception.
This mixin expects a
:logger to be present on the resource. If no
:logger is found, nothing will be logged.
Returns a mixin adding a HAL error representation factory function to the resource, at
:error-representation, for use by other mixins, such as
liberator-mixin.validation when they need to render errors.
The error representation factory function expects the context to include a
:self href, an
:error-id and an
:error-context used in the resulting representation.
Returns a mixin to add the HAL media type to the available media types.