[spec] Allow user to get forms of multi-spec implementations


As noted in this thread (https://groups.google.com/forum/#!topic/clojure/i8Rz-AnCoa8),

does not validate that the specs mentioned within it are valid specs.

A suggested workaround is to separately write code that could inspect the registry and warn about specs that are not declared. A sketch of this code was provided at https://gist.github.com/stuarthalloway/f4c4297d344651c99827769e1c3d34e9

While the general approach is a good one, I believe it won't work for multi-specs that contain "keys" specs.

on a multi-spec will only return that the spec is a multi-spec (which makes sense), but there is no way for a client to get access to code that picks the approach spec given data.

A further workaround is provided in the comments to that gist, but since it relies on

, it will not work on Clojurescript.

I think

is behaving correctly in this case, but it would be useful to have an additional function that, given a multi-spec, could return a function or data that could be used to explore the current implementations.


org.clojure/spec.alpha "0.1.143"




Ben Brinckerhoff




Affects versions