Fork me on GitHub
#reitit
<
2019-11-06
>
valerauko03:11:56

is there a way to add a default-handler inside a ring-router?

valerauko03:11:34

i have logging middleware that depends on the router's :match being present in normal cases, but i'd also want to log 404s

ikitommi06:11:49

@vale you can put ["/*"] as the last route, but then, all routes are run with linear-router, so, slow. What info do you need from a Match?

valerauko07:11:58

the route template. so that i can see endpoint stats without having to re-transform logs to get rid of path params

ikitommi08:11:43

what would the path tempalte be in case of not matching anything?

valerauko08:11:01

there wouldn't need to be a match at all. i could handle that as a special case. (current) logger inside router: cannot log 404 logger outside router: no access to match object at all maybe something instead of a match object, with some error-status, like :reitit.core/no-matching-path or :reitit.core/no-matching-method instead of returning nil?

niwinz08:11:13

@ikitommi are you going to bump a sieppari version soon?, seems like the develop branch already fixes the issues that i found with the released version (is just for know what to do, becuase i'm building a system that depends on it)

niwinz08:11:25

additonally, what to you think about removing the sieppari.async.promesa namespace and just use the completableFuture api for the three operations that AsyncContext need to implement? (promesa already works with completion stage so this will make it easy to use directly with promesa with no aditional namespace require dependencies, i'll do the PR for it)

ikitommi09:11:58

@niwinz I think too we should remove the .promesa. PR welcome!

ikitommi09:11:22

Also, I think default support for core.async & manifold are removed from the master => the sieppari.core loads in some hundreds of millis instead of 7+sec if you had c.a & m on classpath.

ikitommi09:11:28

also, not sure anyone wan’t to support many async ways in a single dispatcher, the choice could be explicit.

💯 4
niwinz09:11:52

completly agree

niwinz09:11:09

i'll do the PR for promesa

💪 4
ikitommi14:11:19

@niwinz pushed out [metosin/sieppari "0.0.0-alpha8"]

tavistock17:11:07

I am getting Execution error (ExceptionInfo) at reitit.exception/exception (exception.cljc:19). No implementation of method: :into-interceptor of protocol: #'reitit.interceptor/IntoInterceptor found for class: io.pedestal.interceptor.Interceptor when trying to use pedestal interceptors, namely io.pedestal.interceptor.error/error-dispatch, when using reitit.pedestal in 0.3.10. Can i not use actually pedestal interceptors and only use the function/hashmap version in reitit.pedestal?

telekid17:11:55

Good PST morning! I’m having a bit of trouble understanding how to define custom spec transformers. A simplified version of my goal is to do something like this: 1. define a spec like (s/def ::amount decimal?) 2. create a spec transformer that transforms a string representation of a decimal amount (like “12.345678”) into a BigDecimal for all specs defined as predicate decimal?, e.g. ::amount. First, I suppose I should confirm that this is this what Spec Transformers are designed to do. My understanding (or at least my hope) is that they allow you to register codecs with spec predicates. Is that correct? I’ve read through https://www.metosin.fi/blog/spec-transformers/ and https://cljdoc.org/d/metosin/spec-tools/0.10.0/doc/spec-driven-transformations, but I still can’t quite figure out how to put the pieces together. CC @clojurians827

telekid21:11:26

That did it. Thank!

ikitommi18:11:56

:decode/json if for json, :decode/string from path, header, body & query-params.

ikitommi18:11:26

@tavistock Goal was to make it work, so sounds like a bug. Please write an issue out of that. Meanwhile you can say (into {} pedestal-interceptor) to make it work

👍 4