Fork me on GitHub
#reitit
<
2023-05-16
>
DrLjótsson11:05:24

Maybe you are getting the error message for the first option? What happens if you switch their order?

danielneal12:05:40

Yes that’s exactly it, if I switch the order I get a better error message. The thing is the data could be either of these two and I would like the most detailed error message, rather than the invalid type one…

DrLjótsson16:05:21

I’ve never used multischemas so can’t advise there. But perhaps you could iterate over the options and explain each one of them.

ikitommi17:05:11

Any ideas on how to define "most detailed error message"?

danielneal17:05:46

Very good question!

ikitommi17:05:22

maybe definw type-error to be worst, everything else as "better"?

danielneal17:05:35

ha yes that's probably enough tbh

danielneal17:05:14

in my specific case the issue was a time object where a string was expected

danielneal12:05:13

I think I can make it work with a multi-schema, but I wonder if there is a larger misunderstanding I have

danielneal12:05:01

maybe there’s an option to explain ?

Marc Gannon16:05:15

Is :conflicting supposed to be an invalid key in a route by default? I get this invalid route error when creating the router. I can alter the spec so its valid but I just want to check if it should be allowed as a default key or if I'm missing something else

Marc Gannon17:05:15

I'm using "0.7.0-alpha3". It looked to me like its using these default values but I'm not too familiar with the code: https://github.com/metosin/reitit/blob/0b6ed627382ea6bd571e22317fb09555a2a850b4/modules/reitit-ring/src/reitit/ring/spec.cljc#L22 My ring/router configuration in case its helpful

(ring/router
   (routes component)
   {;; :reitit.middleware/transform dev/print-request-diffs ;; Uncomment to log each middleware's changes
    :conflicts log-conflicting-routes
    :validate rrs/validate
    :reitit.spec/wrap spell/closed
    :exception pretty/exception
    :reitit.coercion/parameter-coercion strict-query-params-parameter-coercion
    :data {:coercion reitit.coercion.schema/coercion
           :muuntaja m/instance
           :middleware [;; Middleware is called in descending ↓ order
                        openapi/openapi-feature
                        parameters/parameters-middleware
                        muuntaja/format-negotiate-middleware
                        muuntaja/format-response-middleware
                        middleware/log-and-return-exceptions-middleware
                        muuntaja/format-request-middleware
                        middleware/coerce-request-exceptions-middleware
                        ring-coercion/coerce-request-middleware
                        multipart/multipart-middleware]}}))