Fork me on GitHub
Yuner Bekir19:06:42

Hello! eastwood keeps throwing me a warning for the following lines

    {: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)


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.

Yuner Bekir20:06:10

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?

Yuner Bekir20:06:45

yup for the last one, and parse is a required part of the so called apidesc, I just missed it since its getting late

Yuner Bekir20:06:01

the issue is resolved thank you soo much


Might be worth adding an assert into the macro so you can't forget :parse

🙌 1