Fork me on GitHub
#reitit
<
2019-12-18
>
valerauko06:12:07

is there a way to add :description to parameter specs in swagger?

ikitommi06:12:58

adding :swagger/description property to spec might do it.

valerauko06:12:13

{:parameters {:header {:authorization ::auth-spec/bearer-header}}}
Where do I put that :swagger/description?

ikitommi06:12:55

data-spec is kinda too simple for these. Malli will make all these obvious. But, you need to wrap the spec into ds/spec or st/spec. There should be an example under reitit examples.

ikitommi06:12:26

Also, go vote the spec metadata jira, think it's 3+ years old now.

👍 4
valerauko15:12:17

when i read sentences like this my hope for clojure falters

👍 4
ikitommi18:12:15

just build your own tools, or use some by us 🙂

ikitommi18:12:25

(require '[malli.core :as m])

(def Age
  [:and
   {:title "Age"
    :description "It's an age"
    :json-schema/example 20}
   int? [:> 18]])
   
(m/properties Age)
; => {:title "Age"
;     :description "It's an age"
;     :json-schema/example 20}