metosin / malli

High-performance data-driven data specification library for Clojure/Script.
Eclipse Public License 2.0
1.48k stars 210 forks source link

More robust providers #74

Open ikitommi opened 5 years ago

ikitommi commented 5 years ago

The followings should be inferred, via options on threshold?

There should be a easy way to plug in custom user-land schemas like :counted (plug in custom code for both stats & schema generation)

stathissideris commented 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?

ikitommi commented 4 years ago

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.