Fork me on GitHub
#babashka
<
2021-11-05
>
ag00:11:57

Not exactly babashka question. I think this channel needs to be renamed to "borkdude helpline" or something 🙂 I need to write a custom kondo hook/analyze-call for compojure.api.core macros. Has anyone done anything similar?

Bob B02:11:24

I can't say I've done it, but in case it helps, there's an example in the docs at <https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md#analyze-call>

borkdude08:11:40

@U0G75ARHC Let's take this to #clj-kondo which seems more appropriate for this question

borkdude08:11:58

@U0G75ARHC You can use :analyze-call or :macroexpand : the latter one is a bit easier than the first one but you'll get less precise warnings location-wise.

ag17:11:36

> Let's take this to #clj-kondo Ooops. I got confused when searching; Slack has not suggested me the channel while I was typing. Emacs completion frameworks have spoiled me. Joining the channel posthaste.

borkdude17:11:55

No problem :)

ag00:11:47

kondo's source has implementation for compojure, but a) it's not the same as compojure.api b) there's a lot going on there in clj-kondo.impl.analyzer I don't know if can find all pieces there I need to build that hook

❤️ 2
javahippie08:11:12

Good morning! We are automating a lot of infra stuff with bb, and I got tired of writing the same boilerplate code for HTTP clients over and over again…

clojure-spin 4
javahippie08:11:51

Still trying to find an elegant way for path params (and probably a more elegant way to dynamically create the client functions)

javahippie08:11:24

@U04V15CAJ as far as I see, babashka.curl has no concept of path parameters, right?

borkdude08:11:06

I don't think so. Are there any examples of http clients that have this built in?

javahippie08:11:16

Thought cljs-ajax had them, but I was wrong. The concept is more often used to describe the API in the server, I guess, clients can build their URLs quite easy after all

borkdude08:11:56

(str/join "/" [.. .. ..]) :)

🙂 1
alexdavis09:11:31

You could use something like reitit

borkdude09:11:57

AFAIK reitit doesn't work with babashka

borkdude09:11:21

and it's a bit overkill for just putting together a string with some slashes perhaps?

javahippie09:11:23

Love reitit, but agree that it might be too much. Will strengthen my regex chops for this one :)

borkdude09:11:46

@U0N9SJHCH There is this ruuter library which is compatible with bb. https://github.com/askonomm/ruuter Perhaps there are some parts that you can lift out for your purposes.

🙏 1
lispyclouds12:11:24

@U0N9SJHCH i use a fn like this: https://github.com/lispyclouds/contajners/blob/main/src/contajners/impl.cljc#L56-L71 for using path params supplied as a map in a url picked up from a swagger yaml. quite simple but good enough for my usecase 😄 maybe its of your interest?

lispyclouds12:11:59

And i too use it in conjuction with bb curl 🙂

javahippie12:11:13

@U7ERLH6JX Similar to what I tried, but nicer. Going to steal it (with attribution and according to license 🙂 ) Thanks!

lispyclouds12:11:56

🙏:skin-tone-3:🙏:skin-tone-3: