Fork me on GitHub

Hi! I’m trying to get malli 0.8.4 to generate clj-kondo config for my browser CLJS project, trying this code

(ns mynamespace
(:require-macros [ :as dev]))

(defn test-fn
  "return y when x is larger than 5"
  {:malli/schema [:=>
                  [:cat :int :keyword]
                  [:maybe :keyword]]}
  [x y]
  (when (< 5 x)

(dev/start! nil)

(test-fn 1 2)
Instrumenting seems to work and I’m getting the expected validation error in my browser console, but I’m seeing no clj-kondo config being generated for my function schema, only seeing this in .clj-kondo/metosin/malli-types:
{:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}}}


it looks like cljs support broke during a refactor of how function schemas are stored (there is now a map for :clj and one for :cljs) so the kondo data is looking up :clj even in :cljs code: I should have some time over the next few days to send a pr to address this


Right, that’s what I suspected too, since the CLJS support was pretty fresh. Thank you so much for looking into it!

Martynas Maciulevičius16:03:25

Hey. Is there a way to generate a value from a predefined list of values? Or maybe it's possible to "remember" previously generated values so that they would be able to be reused to produce random connections (as in DB sense)?



(mg/sample [:any {:gen/elements [1 2 3]}])
; => (1 1 3 2 1 1 2 1 1 1)


Simple newbie question: For malli.generator/generate is there a way to force malli to generate all fields, including optional?


at the moment, no. But would be 1-2 extra lines of code: • new option :mg/generate-optional-values • read it here - if true always, if false never, default to nil (current) • add a test • document int README

👍 1