Fork me on GitHub
#reitit
<
2024-03-13
>
joshkh10:03:28

hello! i’m stuck with com.fasterxml.jackson.core/jackson-core 2.12.3 on Datomic Ions, where the latest metosin/jsonista fails to compile. what’s the latest version of metosin/reitit i can get away with? perhaps https://github.com/metosin/reitit/blob/0.5.18/project.clj?

andre.richards15:03:41

We are using 0.6.0 (the latest non-alpha release) but with the caveat that you can't depend on the 'all bundled' reitit. Specifically, we found that it was reitit-swagger-ui that caused the clash with datomic ions. So instead of (which pulls in all modules):

[metosin/reitit "0.6.0"]
We list only the modules that we use:
metosin/reitit-core       {:mvn/version "0.6.0"}
metosin/reitit-ring       {:mvn/version "0.6.0"}
metosin/reitit-middleware {:mvn/version "0.6.0"}
metosin/reitit-malli      {:mvn/version "0.6.0"}
metosin/reitit-swagger    {:mvn/version "0.6.0"}
metosin/reitit-sieppari   {:mvn/version "0.6.0"}
metosin/reitit-dev        {:mvn/version "0.6.0"}
You might have to list some other modules, depending on if you use spec/schema/interceptors. Remember that you have to remove the route that serves the swagger-ui. This is only the static assets for the front-end that is used to browse the API documentation, it does not affect the generation of swagger.json file itself. We just host the swagger-ui somewhere else - it's just some HTML & JavaScript that you can get from the Swagger website (if you are using Swagger, that is).

joshkh16:03:31

hi @U08AYNSSK, really great of you to help. thank you. we eventually settled on the same solution: use the latest stable reitit release excluding swagger-ui, and host the static ui somewhere else. it would have been nice to package the json and the ui in one place, but oh well 😎

andre.richards16:03:54

Yip. Sorry I only saw this now, could've saved you some time investigating the issue again... 😆

joshkh16:03:04

thanks just the same. at least we had a learning opportunity!

vemv13:03:17

In reitit, Is there a favorite way to set basic request info (url, method) that the Thread$UncaughtExceptionHandler will see? I could use thread-local storage, but it's often inadequate (e.g. what if I'm using an async server) There's also dynamic bindings (as implied by e,g, timbre/with-context ) but those can be easily lost

vemv13:03:37

Sounds like something that reitit.ring.middleware.exception/create-exception-middleware can be tweaked to do :thinking_face: duckie