Skip to content

Releases: oliyh/martian

Encode the world

28 Feb 16:08
Compare
Choose a tag to compare

This release breaks:

  • Any use of the encode-body and coerce-response interceptors in the clj-http, httpkit or cljs-http namespaces. These interceptors have been unified under martian.interceptors, see #23

This release adds support for:

  • Supporting custom encoding in addition to the built-in support for transit+msgpack, transit+json, edn and json #23

This release fixes:

  • Identical requests sent while the previous request is still pending are deduplicated in martian-re-frame #48

This release improves:

  • Documentation on per-route interceptors #49
  • Documentation on providing body parameters #50

UUIDs and reflections

02 Feb 19:16
Compare
Choose a tag to compare

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!

24 Aug 22:02
Compare
Choose a tag to compare

This release contains enhancement #46 allowing kebab-cased keywords for all parameters, even in deeply nested bodies.

One for the re-framers

15 Aug 21:07
Compare
Choose a tag to compare

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 #41
  • re-frame bootstrap signature now allows you to pass in your own interceptors and options #36
  • re-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

15 Aug 21:03
Compare
Choose a tag to compare

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:

  • Optionally destructure body params #31
  • Maybe schemas prevent body destructuring #35
  • Query and body param names cannot be kebab cased #32
  • Map idiomatic kebab keys for params for query, headers, body, form #34

Per-route interceptors

28 Dec 13:06
Compare
Choose a tag to compare

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

22 Nov 19:51
Compare
Choose a tag to compare

Fixed a bug where consumes parameter was taken from the produces key resulting in incorrect serialisation on bodies where consumes was different to produces.

d819408

Generative testing & non-Swagger support

07 Nov 18:33
Compare
Choose a tag to compare

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

07 Nov 18:34
Compare
Choose a tag to compare

Please view the readme for details.