This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-14
Channels
- # aleph (10)
- # announcements (2)
- # beginners (228)
- # calva (18)
- # cider (6)
- # clara (5)
- # cljdoc (25)
- # cljs-dev (22)
- # clojure (78)
- # clojure-dev (30)
- # clojure-europe (2)
- # clojure-finland (1)
- # clojure-italy (32)
- # clojure-nl (21)
- # clojure-uk (126)
- # clojurescript (34)
- # cursive (5)
- # data-science (2)
- # datascript (2)
- # datomic (26)
- # defnpodcast (1)
- # emacs (5)
- # figwheel (5)
- # figwheel-main (3)
- # fulcro (14)
- # graphql (5)
- # jobs (1)
- # keechma (4)
- # nrepl (5)
- # off-topic (35)
- # onyx (3)
- # pedestal (12)
- # random (1)
- # re-frame (35)
- # reagent (8)
- # reitit (20)
- # remote-jobs (5)
- # ring-swagger (20)
- # shadow-cljs (166)
- # sql (43)
- # vim (6)
- # yada (15)
I think parts of the ring-defaults could be wrapped into Middleware
maps, so that we could be inspected & inventoried easier. Also the implementation & configuration could be revisited: via middleware parameters or via route data. Both ways, the configs should be specced.
when i use [metosin/reitit "0.2.7"], I want config optional-key , [schema.core :as s] , when I write this code is right, :parameters {:query {:x int?, :y int?}}
but when I change to :parameters {:query {:x s/Int, :y s/Int}}
, I get a error Exception in thread "main" java.lang.Exception: Unable to resolve spec: :clojure.spec.alpha/unknown, compiling:(core.clj:43:5)
, or I write this :parameters {:query {(s/optional-key :x) s/Int}}
, I get error Exception in thread "main" java.lang.Exception: Unable to resolve spec: :x, compiling:(core.clj:43:5)
, How can I fix it 🙂
@arlicle you can’t mix spec & schema syntax: {:x int?, :y int?}
uses data-spec syntax (https://cljdoc.org/d/metosin/reitit/0.2.8-SNAPSHOT/doc/coercion/data-specs), {:x s/Int, :y s/Int}
is Schema (https://cljdoc.org/d/metosin/reitit/0.2.8-SNAPSHOT/doc/coercion/plumatic-schema)
to have optional-key with data-specs try:
(require '[spec-tools.data-spec :as ds])
{(ds/opt :x) int?, :y int?}
["/assets/swagger/*"
{:handler (constantly nil)
:middleware [#(swagger-ui/wrap-swagger-ui % {:path "/api/assets/swagger/"})]}]