Muuntaja
as Protocol instead of Record. Fixes #59UTF-8
call path with JSONISTA, 2x faster, 20-30% perf improvement with e2e JSON echo.muuntaja.core
: decodes
, encodes
, matchers
, charsets
, default-charset
, default-format
, formats
and muuntaja?
[com.fasterxml.jackson.core/jackson-core "2.9.3"]
:allow-empty-input?
was true
- which was on by default.[cheshire "5.8.0"] is available but we use "5.7.1"
com.fasterxml.jackson.databind.util.LRUMap
, fixing #33.
[Jackson Databind](https://github.com/FasterXML/jackson-databind)
BREAKING: Drop default support for custom encoding of records.
BREAKING: Handling empty responses
:allow-empty-input-on-decode?
is now called :allow-empty-input?
. It's a boolean:
true
(default): empty input(stream) is decoded into nil
false
with cause the decoder to do whatever it does (e.g. Transit fails, Cheshire returns nil
)BREAKING: muuntaja.json is now a separate library, jsonista
BREAKING: Muuntaja only supports Ring 1.6.0 or later. #47
jsonista decoder now allows using non-UTF charsets. #24
updated deps:
[cheshire "5.7.1"] is available but we use "5.7.0"
optimized muuntaja.middleware/wrap-params
, up to 3x faster for many common cases, thanks to Dmitri Sotnikov!
New option to allow empty input on decode, :allow-empty-input-on-decode?
(default to false
). If set to true
, empty inputstreams map to nil
body, otherwise, the decoder decides what happens (transit fails on default, cheshire does not).
BREAKING: by default, application/msgpack
and application/x-yaml
are not used (smaller core)
application/yaml
: [circleci/clj-yaml "0.5.5"]
application/msgpack
: [clojure-msgpack "1.2.0" :exclusions [org.clojure/clojure]]
(require '[muuntaja.core :as m])
(require '[muuntaja.format.msgpack :as msgpack-format])
(require '[muuntaja.format.yaml :as yaml-format])
(m/create
(-> m/default-options
(yaml-format/with-yaml-format)
(msgpack-format/with-msgpack-format))
; #Muuntaja{:produces #{"application/json"
; "application/x-yaml"
; "application/msgpack"
; "application/transit+msgpack"
; "application/transit+json"
; "application/edn"},
; :consumes #{"application/json"
; "application/x-yaml"
; "application/msgpack"
; "application/transit+msgpack"
; "application/transit+json"
; "application/edn"},
; :default-charset "utf-8",
; :default-format "application/json"}
Alpha: The new muuntaja.json
JSON encoder & decoder
All middleware support now the ring-async 3-arity version:
muuntaja.middleware/wrap-exception
muuntaja.middleware/wrap-params
muuntaja.middleware/wrap-format
muuntaja.middleware/wrap-format-negotiate
muuntaja.middleware/wrap-format-request
muuntaja.middleware/wrap-format-response
BREAKING: move and rename http-negotiation keys from top level to :http
in options:
:extract-content-type-fn
=> :extract-content-type
:extract-accept-charset-fn
=> :extract-accept-charset
:extract-accept-fn
=> :extract-accept
:decode?
=> :decode-request-body?
:encode?
=> :encode-response-body?
BREAKING: muuntaja.options
namespace is thrown away.
muuntaja.core
: transform-formats
& select-formats
muuntaja.options/default-options-with-format-regexps
can be copy-pasted from below:(def default-options-with-format-regexps
(-> m/default-options
(assoc-in [:formats "application/json" :matches] #"^application/(.+\+)?json$")
(assoc-in [:formats "application/edn" :matches] #"^application/(vnd.+)?(x-)?(clojure|edn)$")
(assoc-in [:formats "application/msgpack" :matches] #"^application/(vnd.+)?(x-)?msgpack$")
(assoc-in [:formats "application/x-yaml" :matches] #"^(application|text)/(vnd.+)?(x-)?yaml$")
(assoc-in [:formats "application/transit+json" :matches] #"^application/(vnd.+)?(x-)?transit\+json$")
(assoc-in [:formats "application/transit+msgpack" :matches] #"^application/(vnd.+)?(x-)?transit\+msgpack$"))
default-options support all JVM registered charsets (instead of just utf-8
)
re-organized namespaces & code: formats now in separate namespaces
fixed Accept header parsing to allow e.g. non-numeric parameters (#67)
Updated deps:
[cheshire "5.7.0"] is available but we use "5.6.3"
[com.cognitect/transit-clj "0.8.300"] is available but we use "0.8.290"
[com.fasterxml.jackson.core/jackson-databind "2.8.7"] is available but we use "2.8.4"
Initial public version.
Can you improve this documentation? These fine people already did:
Tommi Reiman, Miikka Koskinen & Juho TeperiEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close