Fork me on GitHub
#yada
<
2015-10-13
>
malcolmsparks08:10:50

@stijn - yes, it's possible. All the tests pass on master, but of course that may not be sufficient. Is there a something you need to work that you can send me so I can take a look?

stijn08:10:00

I'll try to create a minimal example where I see the problem, but for now, I see s/enum, java.util.UUID and s/Keyword that are not being coerced

stijn08:10:03

@malcolmsparks: about merge-options, is that OK to create a deep-merge?

malcolmsparks08:10:34

Yes, in fact it's only really an example of what you can do with a general pre-walk or post-walk of the tree. I suggest you manipulate the tree in the way you want, and if you think it's worth promoting the logic to others, submit it to me and I'll add it to the code-base

stijn08:10:25

I have another question (about bidi): let's say I want to create an endpoint that redirects /news to /media?type=news, is there a standard way of doing this, or should I create something like the Redirect record that does this?

stijn09:10:03

@malcolmsparks: this is the minimal example

stijn09:10:39

(require '[yada.yada :as yada]
         '[aleph.http :refer [start-server]]
         '[schema.core :as s])
(start-server
         (yada/yada (fn [ctx] (format "Hello %s!" (-> ctx :parameters :name)))
                    {:parameters {:get {:query {:name s/Keyword}}}})
         {:port 3001})

stijn09:10:08

$ git rev-parse HEAD
7281fadc7fd13e835f309fa6827a103004127ab2

stijn09:10:38

same if I make it s/Int and request http://localhost:3001/?name=2

malcolmsparks10:10:05

@stijn use a Redirect record, there's one in bidi - they're strictly separate resources

malcolmsparks10:10:49

@stijn, thanks for those examples, I'll take a look later today

stijn13:10:28

I'm not sure how you can specify any extra query parameters on a Redirect

stijn13:10:48

and pass on query parameters of the original request

malcolmsparks13:10:07

@stijn. You might need to write your own Matched record for that, take the :query-string from the request and add it to the location.

stijn14:10:29

@malcolmsparks: cool, that works indeed simple_smile