malli

https://github.com/metosin/malli :malli:
2021-04-20T08:03:56.471Z

Is there an option to support blank string in :enum schema. :maybe supports nil but not blank values. currently i used [:or empty? [:enum "foo" "bar"]] to do this validation but is there a way to create a optional-enum registry that supports this scenario. The problem I'm facing using :or is I'm getting two error messages for each options. It would be better to have one message that says, value can be blank or either one of the valid values

2021-04-20T08:07:51.471100Z

[:enum "" "foo" "bar"] should work https://malli.io/?value=1&schema=%5B%3Aenum%20%22%22%20%22foo%22%20%22bar%22%5D

2021-04-20T08:08:20.471300Z

however error message will hide empty string

2021-04-20T08:08:46.471500Z

["should be either , foo or bar"]

2021-04-20T10:24:12.471700Z

Thanks @delaguardo

anonimitoraf 2021-04-20T11:55:42.473Z

Hi guys, I came across https://github.com/metosin/malli/issues/125 when looking for ways to "instrument" functions. My question is, how do you guys "instrument" functions with malli at the moment?

Ivan Fedorov 2021-04-20T18:12:34.476100Z

Hey folks ๐Ÿ‘‹ Are you aware of any generators built on malli ? Interested in crux pull vector, pathom resolvers, entity constructors, fulcro queries

๐Ÿ‘‹ 1
ikitommi 2021-04-20T21:03:15.476900Z

commented on the instrument issue, sorry for the lag.

ikitommi 2021-04-20T21:04:52.478800Z

@d.ian.b do you mean value generators or schema generators (providers)? Both would be cool. plan is to support EQL for slicing schemas at some point.

1
rutledgepaulv 2021-04-22T02:59:05.006500Z

I don't mind things being in core if they don't require dependencies but if it's going to bloat the malli dep tree would prefer separate modules so I can keep my projects lean. Maybe that's an easy way to draw the line?

๐Ÿ‘ 2
2021-04-26T14:28:21.015200Z

@marciol @mauricio.szabo

marciol 2021-04-26T15:47:59.015600Z

To me seems that at first glance it'd be better to separate all functionality that isn't essential to make Malli works in separated libs, but if we think about Malli as a full experience in terms of how to deal with schemas - and I hope that it became the best in class tool to work with external data, to such a point that people of other ecosystems really envy the Malli experience - I think that the full-batteries included is a better approach, so I really don't mind if all those niceties are included on Malli itself.

ikitommi 2021-04-20T21:07:20.480800Z

oh, and merged 414, breaking change for the extender api. But schemas can now be described with schemas (just need to describe all schemas first :)), the new IntoSchema protocol:

(defprotocol IntoSchema
  (-type [this] "returns type of the schema")
  (-type-properties [this] "returns schema type properties")
  (-properties-schema [this] "maybe returns :map schema describing schema properties")
  (-children-schema [this] "maybe returns sequence schema describing schema children")
  (-into-schema [this properties children options] "creates a new schema instance"))

ikitommi 2021-04-20T21:08:34.482Z

also, most malli.utilfunctions got bit faster as schema instances now have a direct handle to parent, no need to create new instances. which is nice.

ikitommi 2021-04-20T21:09:19.482500Z

e.g. ยดm/type` is looked via the parent:

(defn type
  "Returns the Schema type."
  ([?schema]
   (type ?schema nil))
  ([?schema options]
   (-type (-parent (schema ?schema options)))))

ikitommi 2021-04-20T21:09:46.483Z

so, the public api remains the same.

refset 2021-04-20T22:08:12.483300Z

Uhh, I think the wrong I.F. ๐Ÿ™‚ /cc @ognivo

๐Ÿ‘ 1
โค๏ธ 1