Liking cljdoc? Tell your friends :D

ring.middleware.jsonapi


vnd-api-json-regexpclj

source

wrap-requestclj

(wrap-request handler)
(wrap-request handler
              {:keys [content-type-regexp excluded-uris]
               :as opts
               :or {content-type-regexp vnd-api-json-regexp excluded-uris #{}}})

Strips a Ring request body from JSON API attributes. It updates :body and :body-params attributes in the request thus the request body will be simple object.

Options:

  • :accept-regexp - a regular expression used to detect is a response should be decorated
  • :excluded-uris - a set or URIs that will be excluded from decorating
Strips a Ring request body from JSON API attributes. It updates `:body` and
`:body-params` attributes in the request thus the request body will be simple object.

Options:
- `:accept-regexp` - a regular expression used to detect is a response should be decorated
- `:excluded-uris` - a set or URIs that will be excluded from decorating
sourceraw docstring

wrap-responseclj

(wrap-response handler)
(wrap-response handler
               {:keys [accept-regexp excluded-uris]
                :as opts
                :or {accept-regexp vnd-api-json-regexp excluded-uris #{}}})

Decorates a Ring response as JSON API response. It expects following keys in the given response:

Options:

  • :jsonapi - an object that will be appended to a root of a body
  • :accept-regexp - a regular expression used to detect is a response should be decorated
  • :excluded-uris - a set or URIs that will be excluded from decorating
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-links

Options:
- `:jsonapi` - an object that will be appended to a root of a body
- `:accept-regexp` - a regular expression used to detect is a response should be decorated
- `:excluded-uris` - a set or URIs that will be excluded from decorating
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close