Shortcut for merging properties
(Originally mentioned on Slack)
In my experience, it is quite common having a schema that is valid for most cases but once in a while, would need some change in properties, like altering :min / :max values or generation with :gen/fmap. Hence, the following would be a very convenient way of quickly reusing a schema like so:
{:int-vec [:vector :int]
:small-int-vec [:int-vec {:max 3}]}
@ikitommi was asking if modifying children was acceptable or not. I would suggest not. Modifying properties usually do not alter the deeper meaning of the schema itself, whereas altering children typically does:
{:int-vec [:vector :int]
:double-vec [:int-vec :double]}
In contrast, altering only properties is fairly uncontroversial. By altering, I mean merging given ones with the original ones. I would make a great use of such a feature, do you think other users would as well?
To consider: perf cost, suppose I add another indirection by "extending" :small-int-vec, and yet another one on top of that one, that will be a lot of indirection to resolve. There is a balance to maintain between convenience and performance.
I agree, it sort of 'feels' more natural this way, 'extending' schemas in terms of others. We're using malli more like spec (attr-oriented, mutable registry, etc), enhanced with our own custom properties, and this would be really useful