Fork me on GitHub
#reitit
<
2019-08-03
>
doesntmeananything07:08:39

sorry if it's a dumb question, but how would you represent this compojure route

(POST "/register" req
    :return Result
    :body [user UserRegistration]
    :summary "register a new user"
    (auth/register! req user)))
in reitit-swagger? I'm new to clojure and I'm following a tutorial, but I'm stuck at creating a new service route in reitit (tutorial does it with compojure) here's my code:

valerauko03:08:50

your handler function goes there

valerauko03:08:16

auth/register!

marcus11:08:52

I'd suggest to double check the :coercion spec-coercion/coercion and :parameters {:body UserRegistration} lines. In the former it looks like you are using spec instead of schema coercion; in the latter I think you may be missing the parameter name.. Take a look to this excerpt from the docs:

(require '[reitit.coercion.schema])
(require '[schema.core :as s])

(def router
  (r/router
    ["/:company/users/:user-id" {:name ::user-view
                                 :coercion reitit.coercion.schema/coercion
                                 :parameters {:path {:company s/Str
                                                     :user-id s/Int}}}]))
(see Define coercion and Defining parameters sections on the docs https://metosin.github.io/reitit/coercion/coercion.html) Hope that helps