kekkonen 2016-08-26

@vijayakkineni by design, Kekkonen doesn’t make it easy to split parameters into multiple parameter-sets. Having separate query-, header- & body-params makes it harder to use the handler via other channels. We are using Sente & websockets in few projects, where the data is just passed in as a tuple [:search {:type :similar, :linked? false, :origin {}}].

But, it’s doable if you want to do that, at least two ways:

1) read the :request directly in the handler:

(defnk ^:command search
  "Searches a patient"
  {:responses {:default {:schema types/PatientSearchResponse}}}
  [[:request 
    [:query-params type :- (:type PatientSearchRequest}, linked :- (:linked PatientSearchRequest)]]
    [:data origin :- (:origin PatientSearchRequest)]]
  (success data))

2) create a new handler-type into ring-handler. You can set how the request-paramters are mapped into data. See example on the CQRS-api: https://github.com/metosin/kekkonen/blob/master/src/kekkonen/cqrs.clj#L50-L59

the CQRS-style is just an example, we are using a modified version of that (will push that into core at some point).

so, you can define a modified commmand like this:

{:command {:methods #{:post}
           :parameters {[:data] [:request :body-params]
                        [:query] [:request :query-params]}}}

hope this helps.

@ikitommi: thank you that helps.