Fork me on GitHub
#malli
<
2021-05-01
>
Alexis Vincent00:05:32

Are there any projects or examples out there for nifty crux/Malli compat stuff. Schemas or crux helper functions etc

👂 9
Ivan Fedorov10:05:20

@U051V5LLP is the initiator and the sponsor on this one 🙏

Alexis Vincent11:05:39

Yeah so cool! I had a 5 min play with this yesterday! Great work!

Alexis Vincent11:05:24

Any further examples/projects anyone has seen? @U899JBRPF

refset12:05:21

Nothing else that's hit my radar yet, but I'm also very interested by the intersection :) Semi-related: I am also curious about the possibility of Malli->Alloy tooling that could assist with modelling in Crux

Alexis Vincent13:05:36

Can connect in a bit and see what we come up with

dvingo14:05:20

@UJWLUPW13 do you have any use-cases in mind you're looking for? or dev workflows? I have some of my own ideas for helper code I'd want related to crux, but I'm interested to hear of others.

dvingo14:05:33

@U899JBRPF do you have any links or materials on alloy as it relates to crux?

Alexis Vincent14:05:31

Not yet. Just getting started integrating malli and crux (and new to both). Just wrote a transformer that santises crux entities to be passed on to a json api. transforms :crux.db/id -> id and strips out entity type im transacting in. Will get a better feel for what I need as I work with both

Alexis Vincent14:05:02

Malli coersion for crux database migration is going to be 👌

Alexis Vincent14:05:07

And UI generation

Ivan Fedorov15:05:53

Mr Reiman, maybe you could be interested making a video review of the EQL generation I wrote and giving your opinion on a better way to write schema transformers? I think this could be beneficial for those writing transformers based on malli. If yes — we could schedule a video call @U055NJ5CC If no — no worries.

👂 3
ikitommi05:05:11

sure @U0A5V8ZR6, would like to do that, just super busy at work atm, between projects. If the code - and the goal - is available somewhere, I could first try to read that, between things.

Ivan Fedorov08:05:29

Yep, you can look at it here: https://github.com/dvingo/malli-code-gen/blob/main/src/malli_code_gen/gen_eql.clj We have a branch merge pending. If we merge it before you look at the code – we’ll leave you a link in https://github.com/dvingo/malli-code-gen cc @U055NJ5CC Not rushing you with the review. If you can say at what period you will be probably available for that (in a week or three) that would help. Good luck with the workload!

refset18:05:48

Hey @U051V5LLP > do you have any links or materials on alloy as it relates to crux? Nothing published from me yet, but this is worth a look https://www.hillelwayne.com/post/formally-modeling-migrations/ and, whilst not directly Alloy-related, I think principles of https://en.wikipedia.org/wiki/Object-role_modeling are also relevant

dvingo23:05:58

ooohh this looks great, thanks for sharing! I have some reading to do 🙂

🙏 3
Joel15:05:28

i'm mucking with jsonista/malli and would like to use keywords for some map values, eg: { :Nested { :Map { :enums "values" :other "string" }}} How do i get the values for :enums to be keywords, eg :values... yet leave other strings as strings?

ikitommi18:05:44

@joel380 you need to describe a schema with all the parts that need transformations. in your case, simplest way to do it would be:

(require '[malli.provider :as mp]
         '[malli.core :as m]
         '[malli.transform :as mt])

;; infer schema from example value
(def schema (mp/provide [{:Nested {:Map {:enums :values}}}]))

;; create json-decoder for the schema
(def from-json (m/decoder schema (mt/json-transformer)))

;; apply
(from-json {:Nested {:Map {:enums "values" :other "string"}}})
; => {:Nested {:Map {:enums :values, :other "string"}}}

Joel03:05:27

Thanks I got that working. I had a schema with [:enum :value1 :value2] I assumed that would do the conversion, but it didn't work until I added [:and keyword? [:enum ...]]

Joel04:05:01

makes sense though.