(decorate-request resource-name object)
(decorate-request resource-name object id-key)
Decorates a given object
as a JSON API request. Adds an attributes objects and id
attribute if id-key
is provided.
Decorates a given `object` as a JSON API request. Adds an attributes objects and `id` attribute if `id-key` is provided.
(decorate-response response)
(decorate-response response {:keys [jsonapi] :or {jsonapi {:version "1.0"}}})
Decorates a Ring response as JSON API response. It expects following keys in the given response:
:jsonapi.core/resource-name
defines a type
attribute of a response
https://jsonapi.org/format/#document-resource-object-identification:jsonapi.core/id-key
defines a key name for an id
attribute of an response
https://jsonapi.org/format/#document-resource-object-identification:jsonapi.core/meta
an optional meta object https://jsonapi.org/format/#document-meta:jsonapi.core/links
a links object https://jsonapi.org/format/#document-linksDecorates a Ring response as JSON API response. It expects following keys in the given response: - `:jsonapi.core/resource-name` defines a `type` attribute of a response https://jsonapi.org/format/#document-resource-object-identification - `:jsonapi.core/id-key` defines a key name for an `id` attribute of an response https://jsonapi.org/format/#document-resource-object-identification - `:jsonapi.core/meta` an optional meta object https://jsonapi.org/format/#document-meta - `:jsonapi.core/links` a links object https://jsonapi.org/format/#document-links
(strip-response response)
Converts JSON API response to a simple object with an attributes and in ID.
Converts JSON API response to a simple object with an attributes and in ID.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close