Fork me on GitHub
#ring-swagger
<
2017-04-17
>
plins14:04:59

by reading the docs im not so sure how to do it, here is my attempt

(ring/context
    "/docs" []
    ;:middleware [authorized-for-docs?]
    (docs/swagger-routes
     {:ui "/"
      ;:spec "/swagger.json"
      :data {:info {:title "Bla Bla"
                    :description "Bla Bla Bla Bla Bla o Bla"}}}))

plins14:04:41

but when i hit i get Can't read swagger JSON from

ikitommi16:04:51

@plins looks right, I’ll try to see whats up with that.

ikitommi16:04:55

ok… swagger.json path auto-resolution doesn’t work if it’s under a context. I think It should (all the reverse path info should be available), but it doesn’t seem to be implemented.

ikitommi16:04:33

well, it can be set manually:

(context "/docs" []
     (docs/swagger-routes
       {:ui "/"
        :options {:ui {:swagger-docs "/docs/swagger.json"}}
        :spec "/swagger.json"
        :data {:info {:title "Bla Bla"
                      :description "Bla Bla Bla Bla Bla o Bla"}}}))

ikitommi16:04:27

e.g. one can set all the possible options via the swagger-routes, which is kinda nice.

ikitommi16:04:43

also those that effect the swagger-ui itself, for example adding {:options {:ui {:jsonEdit true}}} will cause all the body text-boxes to be rendered as forms.

ikitommi16:04:38

here’s the full list of swagger-ui parameters: http://swagger.io/docs/swagger-tools/#customization-36

ikitommi16:04:43

hope this helps.

ikitommi16:04:50

and - please write an issue of that the :spec path auto-resolution doesn’t work under context.

plins17:04:43

done 🙂 thanks for he fast response