This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-20
Channels
- # architecture (25)
- # beginners (68)
- # cider (10)
- # clara (3)
- # cljs-dev (90)
- # cljsrn (16)
- # clojure (132)
- # clojure-austin (7)
- # clojure-berlin (3)
- # clojure-czech (1)
- # clojure-dusseldorf (1)
- # clojure-greece (5)
- # clojure-italy (39)
- # clojure-spec (5)
- # clojure-uk (78)
- # clojured (2)
- # clojurescript (92)
- # community-development (6)
- # cursive (7)
- # data-science (1)
- # datascript (14)
- # datomic (32)
- # duct (8)
- # emacs (5)
- # figwheel (3)
- # fulcro (47)
- # hoplon (12)
- # jobs (10)
- # luminus (16)
- # lumo (5)
- # off-topic (1)
- # onyx (2)
- # parinfer (47)
- # pedestal (6)
- # re-frame (10)
- # reagent (2)
- # reitit (61)
- # ring (8)
- # ring-swagger (16)
- # shadow-cljs (116)
- # sql (17)
- # utah-clojurians (2)
- # vim (1)
it seems like nested destructuring doesn’t work with the context macro from compojure.api.sweet
is that by design or should i file a bug
for example:
; this works
(context "" {:keys [identity]}
...)
; this doesn't work
(context "" {{{:keys [user-id]} :user} :identity}
...)
@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.
@jimenezsaezjoseantoni older versions of ring-swagger emitted those, should be fix in 0.24.3
: https://github.com/metosin/ring-swagger/blob/1e932951d115706e7724cedd032d623e2d849905/CHANGELOG.md#0243-24102017
@ikitommi well compojure api generates a compiler error and compojure doesn’t so i’d guess a bug in compojure.api.meta then
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)
@nickmbailey I would suspect https://github.com/metosin/compojure-api/blob/master/src/compojure/api/meta.clj#L595
makes sense
i can file a bug
and possibly have some time to look at a fix later this week