Fork me on GitHub
#ring-swagger
<
2016-05-05
>
eigenhombre16:05:36

Hi folks, what’s the best idiom to make showing the browsable Swagger API configurable? I.e. if a var show-swagger-api is true, then http://my-app.com will show the nice, human-friendly API console AND serve all the REST endpoints of my app; but if my var show-swagger-api is false, then it WON’T show the API console — but it will still serve all the REST endpoints. Thanks in advance!

eigenhombre16:05:27

(I do not intend to mutate show-swagger-api except by setting environment variables prior to executing the Clojure program)

ikitommi16:05:19

@eigenhombre: in c-api, api-options are just data and you can manipulate those freely. Something like: (api {:swagger {:ui (if show-swagger-api "/api-docs"), :spec "/swagger.json"}} ...)

eigenhombre18:05:18

thanks @ikitommi ! I forgot that the API changed to make that sort of thing trivial.