Welcome! Please see the About page for a little more info on how this works.

0 votes
in Spec by

In 1.9.0-alpha10, the docstring for {{explain-data}} doesn't mention or describe the meaning of some standard keys/values of its return value, and the use of "path" in the docstring could be clarified to avoid conflation with file paths or namespace paths. Here is the current docstring:
{quote}
Given a spec and a value x which ought to conform, returns nil if x conforms, else a map with at least the key ::problems whose value is a collection of problem-maps, where problem-map has at least :path :pred and :val keys describing the predicate and the value that failed at that path.
{quote}
Here is a possible replacement:
{quote}
Given a spec and a value x which ought to conform, returns nil if x conforms, else a map with at least the key ::problems whose value is a collection of problem-maps, where problem-map has at least :path :pred and :val keys describing the predicate and the value that failed at that path (through possibly embedded specs). The map may also contain a :via key for specs that failed, an :in key for data key(s) of the value that failed, and a :reason key for a string describing the reason for failure.
{quote}
This differs from the existing docstring in two ways:

  1. It inserts "(through possibly embedded specs)" at the end of the existing dostring to clarify and disambiguate the meaning of "path" here.

  2. It adds an additional sentence describing the :via, :in, and :reason keys.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1995 (reported by alex+import)
...