This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-18
Channels
- # admin-announcements (59)
- # beginners (5)
- # boot (99)
- # cider (9)
- # clojure (207)
- # clojure-czech (1)
- # clojure-dev (28)
- # clojure-france (3)
- # clojure-italy (1)
- # clojure-japan (22)
- # clojurescript (234)
- # core-async (12)
- # datascript (1)
- # datomic (60)
- # funcool (137)
- # hoplon (18)
- # instaparse (2)
- # jobs (2)
- # ldnclj (42)
- # ldnproclodo (3)
- # liberator (13)
- # off-topic (21)
- # onyx (2)
- # re-frame (5)
- # reagent (12)
- # ring-swagger (5)
- # testing (17)
i’m trying to use compojure.api.sweet
and schema.core
to define some swagger api endpoints. is there a way to make a query-param optional? i wasn’t able to find an example for it
(context* “/items" []
:tags ["search"]
(GET* "/" []
:return [Item]
:query-params [(s/optional-key s_text) :- (s/maybe String)
s_city :- Long
s_sort_reverse :- (s/maybe Boolean)]
:summary “item[query, city-id]"
(ok (search-items s_city s_text nil nil nil))))
apparently i was doing it wrong with (s/optional-key s_text)
. but what is the correct syntax?
:query-params uses plumbing syntax: [{s_text :- String "default value"}]
awesome it worked! thanks