This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-23
Channels
- # beginners (55)
- # boot (37)
- # braid-chat (1)
- # chestnut (3)
- # cider (4)
- # clara (22)
- # cljs-dev (54)
- # cljsrn (3)
- # clojure (114)
- # clojure-italy (12)
- # clojure-losangeles (3)
- # clojure-portugal (1)
- # clojure-russia (1)
- # clojure-spec (30)
- # clojure-uk (67)
- # clojure-ukraine (1)
- # clojurescript (101)
- # core-async (11)
- # cursive (6)
- # data-science (27)
- # datomic (8)
- # figwheel (3)
- # fulcro (59)
- # graphql (2)
- # hoplon (89)
- # jobs (3)
- # jobs-rus (1)
- # leiningen (3)
- # lumo (19)
- # off-topic (9)
- # om (48)
- # pedestal (2)
- # portkey (4)
- # protorepl (19)
- # re-frame (13)
- # reagent (38)
- # remote-jobs (1)
- # ring-swagger (4)
- # spacemacs (10)
- # specter (2)
It appears that defining a schema using if
prevents it from being shown in Swagger's "example value"—is there a known workaround?
How would one successfully get a description and sample value out of this conditional schema?
@daveliepmann (describe (s/if? string? (s/pred valid-uuid?) schema/Uuid) "unique ID" :default "foobar")
or (field (s/if? string? (s/pred valid-uuid?) schema/Uuid) {:description "unique ID" :default "foobar"})
(I'd use the latter, to avoid kwargs)
Thanks for the help @juhoteperi — :default
works great: (sugar/describe (schema/if string? (schema/pred valid-uuid?) schema/Uuid) "unique ID" :default "unique ID")