malli

https://github.com/metosin/malli :malli:
Helins 2021-05-13T07:38:19.280900Z

Is there something in the current design that could prevent implementing that kind of schema salvaging? This is about altering some properties of an existing schema in a direct way:

{:int-vec [:vector :int]
 :small-int-vec [:int-vec {:max 3}]}
I often have that kind of situation where I have a common schema (eg. :int-vec) but once in a while I have to put more constraints in properties or slightly alter generation (eg. {:max 3} ). Is there another obvious way, besides an external function that recreates the schemas with optional properties?

Helins 2021-05-13T07:55:18.281500Z

(and besides directly using malli.util)

caumond 2021-05-13T11:50:58.283300Z

Hi everybody, I am looking for the documentation of :ref, I always have a doubt if it is needed or not. I find :ref in the example of the documentation but no sentence explaining why it necessary or not.

ikitommi 2021-05-13T12:01:25.283400Z

@adam678 interesting idea. Should the latter fail if it would have children too? Or swap those too, if present?

ikitommi 2021-05-13T12:04:28.283500Z

@caumond :ref is needed for recursion, no other utility I believe. It's implementation is lazy, so validators, explainers, generators etc. are realized only when needed.

caumond 2021-05-15T20:38:48.296700Z

I posted a PR yesterday

ikitommi 2021-05-13T12:04:40.283600Z

Doc PR welcome

Helins 2021-05-13T12:07:10.285600Z

@ikitommi I was thinking of altering properties only since this is both useful and not controversial. Altering properties doesn't change fundamental aspects of a schema (usually, I guess). If we could alter children, the following would look weird, almost evil:

{:int-vec [:vector :int]
 :double-vec [:int-vec :double]}

caumond 2021-05-13T12:10:46.285700Z

😁 I got it !