An attempt to unify things you need around a web api
Because of all this the dependency tree is LARGE
lein deps :tree
This will give us some context for the rest of our slides.
https://github.com/philipsdoctor/compojure-api-demo
Routes have descriptions and schemas.
App setup and UI descriptions
A routing library, one of the most popular downloaded libraries for all of Clojure
https://github.com/metosin/compojure-api/blob/master/src/compojure/api/core.clj
A library for declarative data description and Validation
https://github.com/plumatic/schema
(def Data
"A schema for a nested data type"
{:a {:b s/Str
:c s/Int}
:d [{:e s/Keyword
:f [s/Num]}]})
(POST "/foo/:bar" {:keys [body params]}
(foobar/foo (merge params (walk/keywordize-keys body)))
{:status 200})
--
or **kwargs if you're a python guy
(let [app (build-app)
req (api-request :post "/v1/bar?req-id=tako" {:totalTxBytes 10
:planId "4123EF"
:rxPercentage 98.02})
resp (app req)]
(is (= 200 (:status resp))))