Fork me on GitHub
#ring-swagger
<
2017-07-26
>
ikitommi06:07:58

shipped both [metosin/compojure-api "1.1.11"] & [metosin/compojure-api "2.0.0-alpha6"], with the s/Num coercion, updated deps & spec coercion does s/unform too.

psalaberria00208:07:52

Is it possible to change the Swagger basePath at runtime? I am able to define it in the api declaration (def myapi (api {:swagger {:data {:basePath "/xxx"}}} …), but I wonder if I can change it somehow. Changing myapi to a defn is not an option.

ikitommi08:07:44

@psalaberria002 yes you can override everything at runtime.

psalaberria00208:07:18

via middleware?

ikitommi08:07:24

do you use 1.* or 2.* version?

psalaberria00208:07:47

compojure-api “1.1.10”

ikitommi08:07:56

ok, there is ring.swagger.middleware/wrap-swagger-data which can be used to inject swagger data in.

ikitommi08:07:41

the api puts the whole (statically defined) swagger-data into request under a special key, the swagger-endpoints read that + direct options and merge them together.

plins16:07:29

hello everyone i have some doubts on how to generate proper documentation using spec this spec

(s/def ::non-empty-string (s/and st/string? #(> (count %) 0)))
generate this swagger doc
{ "holdersName": {} }
is there a way to indicate that i want this to be documented as a string?

ikitommi16:07:55

... but you can force a type with (st/spec #(> % 10) {:type :string}).

plins16:07:41

looks like 0.3.1 isnt on clojars, lein cant resolve it as a dependency

plins16:07:50

but hey, thx for the fast response 🙂

ikitommi17:07:36

yeah, snapshot only. I'll push it out when at laptop. The automatic type resolution rules are here: https://github.com/metosin/spec-tools/blob/master/src/spec_tools/type.cljc