This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-15
Channels
- # announcements (13)
- # aws (6)
- # babashka (23)
- # babashka-sci-dev (6)
- # beginners (64)
- # calva (110)
- # cider (25)
- # cljs-dev (5)
- # cljsrn (8)
- # clojars (5)
- # clojure (20)
- # clojure-austin (1)
- # clojure-europe (77)
- # clojure-nl (1)
- # clojure-uk (3)
- # clojurescript (14)
- # cursive (7)
- # datahike (9)
- # datomic (13)
- # eastwood (15)
- # emacs (14)
- # figwheel-main (1)
- # fulcro (8)
- # graalvm-mobile (2)
- # graphql (2)
- # honeysql (2)
- # hyperfiddle (2)
- # introduce-yourself (4)
- # jobs (4)
- # joyride (4)
- # leiningen (4)
- # lsp (8)
- # minecraft (8)
- # off-topic (11)
- # polylith (18)
- # rdf (2)
- # reagent (3)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (39)
- # specter (7)
- # xtdb (3)
Hello! eastwood keeps throwing me a warning for the following lines
(apidesc
{:id :test-webhook
:coll-group (= [!coll :ref] "webhook")
:data [+ (fields helper/local-fields)]
:run (alng/http
{:request {:api-base :http-auth
:path (str "/webhook/" [!settings :team-secret])
:method :get}
:validate (api-lang/validate-err-code "Signl4")})})
when I remove allang/http no more errors are thrown.
The error is
dl.clj:32:11: constant-test: Test expression is always logical true or always logical false: nil in form (if or__5533__auto__ or__5533__auto__ (clojure.core/or)
Thanks!What is alng
aliased to? What ns/library is that from?
Whatever alng/http
expands to (it's a macro) has the construct that Eastwood is complaining about.
alng
is aliesed to afw.apilang. The thing is that I use the same construct on other places and eastwood doesnt complain there
Right, but it's a macro and it's going to expand to different things in different contexts. So this is a context where that macro expands to, essentially, a degenerate condition.
Without seeing the source of that macro, it's hard to say what specifically is going on...
I think it's the :parse
expression -- ~(:parse desc)
is going to cause that expression to be evaluated by the macro, yielding nil
if you pass a literal hash map that doesn't contain :parse
-- also, why is the alt in that or
evaluated?
In addition, you are potentially evaluating desc
multiple times -- it would be better to bind it once to a local symbol and then use that instead.
Assuming this is your macro and you can change it?
I'm not entirely sure I see why this is a macro at all -- I think it could be a regular function?
Ah, because you want :request
in desc
to be a symbolic expression and for it to be walked and have functions resolved in a different context?
yup for the last one, and parse is a required part of the so called apidesc, I just missed it since its getting late
the issue is resolved thank you soo much
thanks