Releases: oliyh/martian
Encode the world
This release breaks:
- Any use of the
encode-body
andcoerce-response
interceptors in theclj-http
,httpkit
orcljs-http
namespaces. These interceptors have been unified undermartian.interceptors
, see #23
This release adds support for:
- Supporting custom encoding in addition to the built-in support for
transit+msgpack
,transit+json
,edn
andjson
#23
This release fixes:
- Identical requests sent while the previous request is still pending are deduplicated in martian-re-frame #48
This release improves:
UUIDs and reflections
This release adds support for:
- UUIDs as added by @markdingram in #47 - thank you
- A subscription to find out what requests are pending - #39
This release fixes:
- Reflection warnings in the JVM libraries
Idiomatic parameters - nested!
This release contains enhancement #46 allowing kebab-cased keywords for all parameters, even in deeply nested bodies.
One for the re-framers
This release improves the martian story in Clojurescript, with improvements to the cljs-http
library and a new library called martian-re-frame
which provides bindings to use martian idiomatically with re-frame.
The API for martian-test
was also improved to allow easier stubbing of responses.
The following issues were addressed:
cljs-http
Leave interceptors are run inside a go block, so they no longer need to be aware of core.async #41re-frame
bootstrap signature now allows you to pass in your own interceptors and options #36re-frame
Added a subscription for the martian instance #37- Martian re-frame should call on-fail if inputs can't be coerced rather than throw exception #38
- Body params don't work for s/Any #44
- Martian test should have helpers to respond for individual operation ids #45
Camel, Snake, Kebab
This release further improves martian's idiomatic Clojure credentials by inferring the mappings between the field names used by the API and the idiomatic Clojure key - for example, if the API requires a key FooBar
you can provide :foo-bar
to martian. This is covered in more detail in #34.
The following issues were addressed:
Per-route interceptors
The major feature introduced in this release is the ability to provide interceptors for individual handlers. This allows you to handle special cases much more elegantly.
They can be defined either as part of the bootstrap
data:
(martian/bootstrap "https://api.org"
[{:route-name :load-pet
:path-parts ["/pets/" :id]
:method :get
:path-schema {:id s/Int}
:interceptors [{:id ::override-load-pet-method
:enter #(assoc-in % [:request :method] :xget)}]}])
Or by using the helper to modify an existing martian record:
(-> (martian/bootstrap-swagger "https://api.org" swagger-definition)
(martian/update-handler :load-pet assoc :interceptors [{:id ::override-load-pet-method
:enter #(assoc-in % [:request :method] :xget)}]))
Other changes include:
- Better support for json array bodies via #26 and #29 - nb this is a breaking change to the parameters for bodies, see #5
- The body can be provided verbatim with
:martian.core/body
, see #30 (thanks @markdingram)
Bugfix: produces/consumes mixup
Fixed a bug where consumes
parameter was taken from the produces
key resulting in incorrect serialisation on bodies where consumes was different to produces.
Generative testing & non-Swagger support
This release focussed mainly on improving the martian API for more practical use and adding the ability to perform generative testing.
- Added response generators for use with test.check and documented usage in the martian-test readme
- Added a
bootstrap
function which accepts data structures describing APIs in a Swagger-like way without requiring Swagger at all - All provided interceptors now behave better with other interceptors that may want to collaborate or override some parameters
- Added support for Boolean type
- cljs-http bootstrap-swagger now works with relative urls as well as absolute
Initial release
Please view the readme for details.