This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-09
Channels
- # announcements (2)
- # babashka (11)
- # beginners (9)
- # biff (7)
- # calva (20)
- # catalyst (1)
- # cider (8)
- # clerk (46)
- # clj-kondo (18)
- # clj-otel (2)
- # clojure-brasil (22)
- # clojure-europe (18)
- # clojure-gamedev (23)
- # clojure-italy (5)
- # clojure-nl (2)
- # clojure-norway (14)
- # clojure-uk (6)
- # clr (1)
- # datomic (13)
- # emacs (1)
- # hoplon (13)
- # hyperfiddle (53)
- # introduce-yourself (1)
- # java (23)
- # malli (7)
- # obb (35)
- # off-topic (31)
- # polylith (2)
- # portal (9)
- # rdf (15)
- # reitit (12)
- # releases (3)
- # ring (4)
- # shadow-cljs (6)
- # solo-full-stack (3)
Is there any existing tools for consuming openapi schemas and producing malli schemas from the openapi data models?
if i recall correctly, OpenAPI uses JSON schema, so you would want to try the patches in https://github.com/metosin/malli/pull/211
Hi, I'm trying to validate that one and only one of two keys in a map is present. e.g {:block/prop1 1 :block/prop2 2 :block/children []}
or {:block/prop1 1 :block/prop2 2 :block/markup "markup"}
I want to make sure that only markup
or children
key is present. Is there a better way to do it without going for multi-schema? Ideally, I'd like to validate keys separately and then for keys that present validate that their attributes/values are of a proper type/shape.
you could use [:and [:map ...] [:fn ...]]
, see https://github.com/metosin/malli#fn-schemas
I was playing around with an idea of adding a :custom-pred
property to the -map-schema
https://app.slack.com/client/T03RZGPFR/CLDK6MFMK
https://github.com/dvingo/malli/commit/1f3d00f8abbc0aafede329d558931f110427f3b5
That would support use-cases like yours in an extensible way.
Something like:
[custom-map-schema {:exclusive-keys #{:block/markup :block/children}}
[..etc]]
I think it would be similar to the :compile
property supported by -collection-schema
but I'm not exactly sure how that works
https://github.com/metosin/malli/blob/39ccfef96b54beb3d862b1eab5f5be90ec0f4456/src/malli/core.cljc#L1188Thanks!