Open ikitommi opened 5 years ago
Some of the above would be possible by using the stats-gathering mechanism of spec-provider. As I am familiar with it, I could help integrate it an extend it to cover any cases that are currently not possible. Do you have any reasons for not adding a dependency to spec-provider?
Sorry for really long time to respond.
One of the key motivations in developing malli was the ability to optimize and refactor the whole, extra features like schema transformation, value generation and value inferring lean on the core and the core has evolved based on requirements of the extra features (new protocols, protocol methods, arguments to visitors etc). I would like to keep it that way.
The current inferring impl is naive and definitely needs lot of work for both stats collection and schema generation, but I would like it to be part of the library. Goal is also to be able to support custom user-defined schema inferring, like there is already extension mechanisms for value generation and schema transformation. Currently multimethods, will most likely add Protocols for those too.
Help on this would be much appreciated. Preference being that the inferring code would reside in malli and all the options would be coherent to the rest of the library, e.g.
{:malli.provider/multi-schema-dispatch {first :type}}
.
Cheers.
The followings should be inferred, via options on threshold?
:maybe
(would be easy if there was:nil
type in the stats:tuple
(option + threshold):enum
(option + threshold):or
for values. e.g.[:or string? keyword?
instead ofsome?
:min
and:max
on collections~:map-of
:multi
There should be a easy way to plug in custom user-land schemas like
:counted
(plug in custom code for both stats & schema generation)