malli

https://github.com/metosin/malli :malli:
Alexis Vincent 2021-05-01T00:58:32.103300Z

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

πŸ‘‚ 3
refset 2021-05-01T10:17:52.103500Z

Good timing! See @ognivo 's new lib https://mobile.twitter.com/spacegangster/status/1388092289084428299

Ivan Fedorov 2021-05-01T10:22:20.105100Z

@danvingo is the initiator and the sponsor on this one πŸ™

Alexis Vincent 2021-05-01T11:17:39.106Z

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

Alexis Vincent 2021-05-01T11:18:24.106200Z

Any further examples/projects anyone has seen? @taylor.jeremydavid

refset 2021-05-01T12:12:21.106500Z

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 Vincent 2021-05-01T13:12:36.106800Z

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

2021-05-01T14:20:20.107Z

@mail024 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.

2021-05-01T14:21:33.107200Z

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

Alexis Vincent 2021-05-01T14:32:31.107400Z

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 Vincent 2021-05-01T14:36:02.107600Z

Malli coersion for crux database migration is going to be πŸ‘Œ

Alexis Vincent 2021-05-01T14:36:07.107800Z

And UI generation

Ivan Fedorov 2021-05-02T15:15:53.119400Z

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 @ikitommi If no β€” no worries.

πŸ‘‚ 1
ikitommi 2021-05-03T05:23:11.121400Z

sure @ognivo, 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 Fedorov 2021-05-03T08:19:29.128600Z

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 @ikitommi 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!

refset 2021-05-03T18:02:48.200500Z

Hey @danvingo > 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

2021-05-03T23:27:58.200800Z

ooohh this looks great, thanks for sharing! I have some reading to do πŸ™‚

πŸ™ 1
Joel 2021-05-01T15:08:28.110600Z

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?

ikitommi 2021-05-01T18:14:44.112100Z

@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"}}}