malli

https://github.com/metosin/malli :malli:
aaron51 2020-12-29T16:16:18.289500Z

How do I describe keywords with a certain namespace? Something like [:qualified-keyword {:namespace :asdf}] to match :asdf/x and :asdf/y

ikitommi 2020-12-29T16:55:40.292400Z

@aaron51 something like [:and :qualified-keyword [:fn (fn [x] (= :asdf (namespace x))]]?

aaron51 2020-12-29T16:56:07.293300Z

yes! thank you

ikitommi 2020-12-29T16:58:59.298Z

You can also create your own :qualified-keyword impl quite easily, on top of malli.core/-simple-schema, which would read the :namespace property and validate it behind the scenes. e.g. the syntax you proposed. Not near computer, but there are examples how to do that kind of stuff in the user space.

ikitommi 2020-12-29T16:59:44.299200Z

Also, sounds useful enough, so you could do a PR of that.

aaron51 2020-12-29T17:00:25.299700Z

thank you, I’ll give it a try 👍

ikitommi 2020-12-29T17:04:23.300900Z

Some examples how to build custom s (simple) schemas: https://github.com/metosin/malli/blob/master/test/malli/core_test.cljc#L1392-L1470