Fork me on GitHub
#malli
<
2021-10-14
>
Ben Sless11:10:34

I'm trying the instrument example from the documentation, while I get the report in the REPL, kondo isn't emitting the lint warnings for it. Am I missing anything?

borkdude11:10:20

@ben.sless Have you added the emitted config to your clj-kondo config?

Ben Sless11:10:51

Looks like I am missing something. The emitted config is written by malli by default to .clj-kondo/configs/malli/config.edn, do I need to include it somehow?

borkdude11:10:29

yeah, in .clj-kondo/config.edn you need to write {:config-paths ["configs/malli"]}

πŸ‘ 1
Ben Sless11:10:20

Thank you πŸ™‚

πŸŽ‰ 1
andre.richards13:10:25

Thanks, this solved it for me as well πŸ™ A question on clj-kondo/malli integration: when a function takes a map as parameter, clj-kondo is highlighting if the passed parameter is not a map, but it does not highlight if the value under a certain key is not correct type. Is this expected, and a hard limitation of clj-kondo/malli, or something that just has not been done (because it will require a lot of work, etc.). I just want to know where to set my expection. 😁

jussi12:10:11

Hey, I ran into the following when converting a schema to PlantUML.

(def value
  [:and
   {:description "Non negative numeric value."
    :json-schema/example 780.56}
   number?
   [:>= 0]])

(def simple-registry
  (merge
   (m/default-schemas)
   (mu/schemas)
   {:value value}))

(def schema-merged
  (mu/closed-schema
   (m/schema
    [:merge
     [:map 
      [:name string?]
      [:age value]]
     [:map
      [:address string?]]]
    {:registry simple-registry})))

(comment
  (plantuml/transform schema-merged))
Now, trying to render PlantUML results in :malli.core/invalid-schema {:schema :merge}. Does plantuml/transform support stuff outside malli.core? The schema-merged above expands into following schema:
[:merge [:map {:closed true} [:name string?] [:age [:and {:description "Non negative numeric value.", :json-schema/example 780.56} number? [:>= 0]]]] [:map {:closed true} [:address string?]]]

dvingo19:10:31

Not sure why the plantuml transform doesn't do this but if you deref the schema, it works:

(plantuml/transform (m/deref schema-merged))

jussi21:10:59

Thanks! Missed that completely πŸ™ˆ

Ivan Fedorov21:10:51

What’s the replacement for a set as a predicate in malli? Analogue of (s/def :spec1 #{:a :b}) Is it [:or [:= :a] [:= :b]] ?

schmee22:10:22

[:enum :a :b] :thumbsup: