Fork me on GitHub
#reitit
<
2021-10-21
>
Ben Sless09:10:56

Not sure if this is an error, but in the coercion namespace, when creating an instance of request coercer, is it possible the wrong parameter is passed to the creator?

(defn request-coercer [coercion type model {::keys [extract-request-format parameter-coercion]
                                            :or {extract-request-format extract-request-format-default
                                                 parameter-coercion default-parameter-coercion}}]
  (if coercion
    (if-let [{:keys [keywordize? open? in style]} (parameter-coercion type)]
      (let [transform (comp (if keywordize? walk/keywordize-keys identity) in)
            model (if open? (-open-model coercion model) model)]
        (if-let [coercer (-request-coercer coercion style model)] ;; <<<<<<<<<<<<<<<<<<< HERE
          (fn [request]
            (let [value (transform request)
                  format (extract-request-format request)
                  result (coercer value format)]
              (if (error? result)
                (request-coercion-failed! result coercion value in request)
                result))))))))

ikitommi12:10:42

everything is possible, PRs welcome 🌈

Ben Sless13:10:43

@U055NJ5CC more like trying to understand if I misunderstand the API, implementation, or if it's a bug Speaking of PRs, what about the walk?

Ben Sless09:10:14

Should -request-coercer be passed style or type?