This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-20
Channels
- # aatree (42)
- # admin-announcements (25)
- # alda (28)
- # aws (56)
- # beginners (67)
- # boot (248)
- # braid-chat (9)
- # cider (52)
- # cljsrn (11)
- # clojars (4)
- # clojure (341)
- # clojure-czech (5)
- # clojure-japan (3)
- # clojure-nl (2)
- # clojure-russia (57)
- # clojured (10)
- # clojurescript (35)
- # community-development (18)
- # cursive (17)
- # datascript (5)
- # datomic (39)
- # dirac (25)
- # editors (2)
- # events (3)
- # hoplon (60)
- # jobs (5)
- # ldnclj (9)
- # leiningen (5)
- # mount (20)
- # off-topic (3)
- # om (263)
- # onyx (69)
- # perun (5)
- # proton (55)
- # re-frame (7)
- # reagent (24)
- # spacemacs (6)
- # yada (16)
@aspra - hi, it is possible but a little tricky. Swagger specs are just plain yada resources, you can hijack these resources (change them before you create handlers from them) and override the :get method to return a modified (:response ctx) rather than the current implementation
if you can describe what you're trying to achieve I could help more
(by providing code snippets)
alternatively you could add in your own interceptor - again, depends on what you're trying to do as to which approach is the most sensible
thanks @malcolmsparks. I want to use a swagger UI hosted somewhere else and I wanted to add the cors headers to the swaggered response. Now I am thinking of adding a proxy instead.
yada does do CORS, and if you look at the swaggered phonebook on http://yada.juxt.pro you'll notice the phonebook itself is on a different origin from the swagger console
@aspra I realise this isn't the same as your set up, but it would be fairly straight-forward to build a swagger spec resource that would publish the swagger spec as a string with CORS headers
if you delve into the code, you'll see that the swagger resource is simply a yada resource that serves up a swagger spec - you could write your own resource, with the CORS headers, and use the same logic that swaggered uses to generate the swagger spec (as a string).
The 'swaggered' function is a bit of a convenience and assumes you are serving the swagger spec on the same origin as your API. For the phonebook example, that doesn't work because they're on different origins. Therefore you'll see it's done a little different - yada is quite flexible in this regard
If you look into the code and examples you should begin to see the various pieces involved and be able to reassemble them in different ways
(I must confess that the CORS stuff is new and not well documented but will be in the coming weeks)
yes - use the examples/phonebook project as a guide. That actually has a few tests around it so is usually accurate
you can see the examples/phonebook project from the repo, suggest you git clone the yada repo too
(sorry, I meant to say the examples/phonebook application is in the same repo as yada)