This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-04
Channels
- # announcements (19)
- # babashka (11)
- # babashka-sci-dev (9)
- # beginners (71)
- # calva (25)
- # cider (1)
- # clara (36)
- # clj-kondo (47)
- # clojure (65)
- # clojure-dev (64)
- # clojure-europe (9)
- # clojure-nl (2)
- # clojure-seattle (1)
- # clojure-uk (2)
- # clojured (8)
- # clojurescript (17)
- # cursive (9)
- # data-science (36)
- # datahike (11)
- # emacs (10)
- # figwheel-main (19)
- # fulcro (15)
- # graalvm (12)
- # humbleui (5)
- # introduce-yourself (3)
- # jobs (10)
- # leiningen (4)
- # lsp (24)
- # malli (7)
- # nextjournal (23)
- # off-topic (1)
- # pedestal (2)
- # polylith (6)
- # portal (1)
- # re-frame (3)
- # reitit (2)
- # releases (2)
- # remote-jobs (1)
- # reveal (9)
- # shadow-cljs (13)
- # spacemacs (6)
- # xtdb (3)
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 [malli.dev.cljs :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)
y))
(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: https://github.com/metosin/malli/blob/002d5cbc724e83f07f126d66b19df022859f1cbf/src/malli/clj_kondo.cljc#L179 https://github.com/metosin/malli/blob/master/src/malli/core.cljc#L2385 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!
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)?
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 https://github.com/metosin/malli/blob/master/src/malli/generator.cljc#L90 - if true
always, if false
never, default to nil
(current)
• add a test
• document int README