This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-01
Channels
- # adventofcode (170)
- # announcements (3)
- # babashka (1)
- # beginners (25)
- # cherry (1)
- # cider (3)
- # clj-kondo (5)
- # cljsrn (9)
- # clojure (27)
- # clojure-art (2)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-sweden (2)
- # clojure-uk (5)
- # code-reviews (12)
- # component (8)
- # conjure (1)
- # data-science (2)
- # hyperfiddle (6)
- # malli (5)
- # off-topic (65)
- # overtone (34)
- # polylith (3)
- # re-frame (2)
- # reagent (2)
- # releases (3)
- # rum (1)
- # shadow-cljs (2)
- # slack-help (8)
- # sql (8)
- # squint (100)
- # thejaloniki (3)
- # tools-build (16)
- # vim (7)
- # yamlscript (1)
Would really love if there were a plug and play way to use Malli with a TypeScript library
I'm looking into this - I haven't made much progress, but all the pieces are there: • Malli can generate JSON Schemas: https://github.com/metosin/malli/blob/master/src/malli/json_schema.cljc • There's many ways of turning JSON Schemas into Typescript types I have a working system that uses Avro schemas that generates Typescript types, but it requires quite a lot of work to use these types in the frontend code. Based on my research and experience something like this: https://redux-toolkit.js.org/rtk-query/usage/code-generation#openapi seems to be way more maintainable .
I haven’t used it, but there’s a library for generating typescript types from malli schemas: https://github.com/flowyourmoney/malli-ts
Is there a fn or approach to do a Clojure-style merge
on a malli.core/schema
?
(def custom-registry
{::thing [:map [:a :string]]})
(def Foo
(m/schema
[:schema {:registry custom-registry}
::thing]
{:registry default-registry}))
(type (m/deref Foo)) ;; :malli.core/schema
(type Foo) ;; :malli.core/schema
;; Not working
(m/schema
[:merge
Foo
[:map [:b :string]]])
=> clojure.lang.ExceptionInfo: :malli.core/invalid-schema {:schema :merge}
{:type :malli.core/invalid-schema, :message :malli.core/invalid-schema, :data {:schema :merge}}