This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-27
Channels
- # ai (4)
- # beginners (102)
- # boot (216)
- # cider (20)
- # cljs-dev (9)
- # clojure (130)
- # clojure-russia (4)
- # clojure-spec (9)
- # clojure-uk (11)
- # clojurescript (59)
- # core-async (2)
- # cursive (10)
- # datomic (51)
- # figwheel (1)
- # flambo (3)
- # hoplon (2)
- # luminus (1)
- # om (17)
- # om-next (4)
- # onyx (2)
- # perun (2)
- # re-frame (79)
- # ring (5)
- # ring-swagger (9)
- # rum (3)
- # schema (3)
- # specter (9)
- # untangled (3)
- # vim (1)
Is there a way how to document path or query params with Swagger? I have API like this :query-params [{approved :- s/Bool true}]
so is it possible to document it?
@petr.mensik you can add documentation to the type via ring-swagger, see here: https://github.com/metosin/ring-swagger#adding-description-to-schemas
here’s an example: https://github.com/metosin/compojure-api/blob/c2274ee56334f9bfae05d69c4311cb95d18626fc/examples/thingie/src/examples/thingie.clj#L56
Cool, thank you, however I cannot get it work the way I want. My param is like this :query-params [approved :- (describe s/Bool "Desc" :required false :default true)]
- what I want is to fallback to true
if the client won't provide the param. However I am getting back exception message with missing-required-key
when I don't provide it
However Swagger docs is correct, drop down also allows to enter empty value and true is the default
:query-params [{approved :- (describe s/Bool "Desc") true}]
you should use describe
together with letk default binding
describe
can generate correct JSON-Schema for required and default properties, but it doesn't affect Schema validation on Clojure side
ahaaa, thanks a lot 🙂 sorry for beginner questions, it's still sometimes hard to read others code