Fork me on GitHub
#ring-swagger
<
2018-02-20
>
nickmbailey02:02:58

it seems like nested destructuring doesn’t work with the context macro from compojure.api.sweet

nickmbailey02:02:10

is that by design or should i file a bug

nickmbailey02:02:15

; this works
(context "" {:keys [identity]}
...)

; this doesn't work
(context "" {{{:keys [user-id]} :user} :identity}
...)

ikitommi07:02:35

@nickmbailey does that work with vanilla Compojure? if it does, it’s a bug in the compojure-syntax parser at compojure.api.meta. I guess I haven’t used that deep with routes.

logistark08:02:47

Thanks, i will take a look!🙂

nickmbailey14:02:37

@ikitommi well compojure api generates a compiler error and compojure doesn’t so i’d guess a bug in compojure.api.meta then

nickmbailey14:02:56

repl session:

dev=> (require '[compojure.core :refer [GET]])
nil
dev=> (require '[compojure.api.sweet :refer [context]])
nil
dev=> (GET "/" {:keys [identity]}
 #_=>   (println identity))
#<Fn@2747f665 compojure.core/wrap_route_matches[fn]>
dev=> (GET "/" {{{:keys [user-id]} :user} :identity}
 #_=>   (println user-id))
#<Fn@11623d80 compojure.core/wrap_route_matches[fn]>
dev=> (context "" {:keys [identity]}
 #_=>   (println identity))
#function[clojure.core/identity]
#compojure.api.routes.Route
{:childs [nil]
 :handler #<Fn@3e251ea0 compojure.core/make_context[handler]>
 :info {}
 :method nil
 :path ""}
dev=> (context "" {{{:keys [user-id]} :user} :identity}
 #_=>   (println user-id))

             java.lang.RuntimeException: Unable to resolve symbol: user-id in this context
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: user-id in this context, compiling:(/private/var/folders/47/631bq0cs75q8gk7jf0r8c30h0000gn/T/form-init2896469317029772128.clj:2:3)

nickmbailey15:02:32

i can file a bug

nickmbailey15:02:52

and possibly have some time to look at a fix later this week

ikitommi15:02:09

that would be great!

ikitommi21:02:24

I’m under 🌴 until 12.3. Juho & Miikka will help with any possible stuff there is.

slipset22:02:43

Have a great vacation!