{"id":19917185,"url":"https://github.com/athos/spectrace","last_synced_at":"2025-07-31T22:06:36.367Z","repository":{"id":62434692,"uuid":"79041875","full_name":"athos/spectrace","owner":"athos","description":"clojure.spec (spec.alpha) library aiming to be a fundamental tool for analyzing spec errors","archived":false,"fork":false,"pushed_at":"2018-07-12T00:00:00.000Z","size":101,"stargazers_count":16,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-24T20:07:07.542Z","etag":null,"topics":["clojure","clojure-spec","clojurescript","error-messages","spec"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/athos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-15T15:42:16.000Z","updated_at":"2023-03-12T15:26:24.000Z","dependencies_parsed_at":"2022-11-01T21:16:07.818Z","dependency_job_id":null,"html_url":"https://github.com/athos/spectrace","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athos%2Fspectrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athos%2Fspectrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athos%2Fspectrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athos%2Fspectrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/athos","download_url":"https://codeload.github.com/athos/spectrace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252154732,"owners_count":21702982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","clojure-spec","clojurescript","error-messages","spec"],"created_at":"2024-11-12T21:49:05.817Z","updated_at":"2025-05-03T06:30:44.537Z","avatar_url":"https://github.com/athos.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spectrace \n[![Clojars Project](https://img.shields.io/clojars/v/spectrace.svg)](https://clojars.org/spectrace)\n[![CircleCI](https://circleci.com/gh/athos/spectrace/tree/master.svg?style=shield)](https://circleci.com/gh/athos/spectrace/tree/master)\n[![codecov](https://codecov.io/gh/athos/spectrace/branch/master/graph/badge.svg)](https://codecov.io/gh/athos/spectrace)\n\n_spectrace_ is a clojure.spec (spec.alpha) library aiming to be a fundamental tool for analyzing spec errors.\n\n## Installation\n\nAdd the following to your `:dependencies`:\n\n[![Clojars Project](https://clojars.org/spectrace/latest-version.svg)](http://clojars.org/spectrace)\n\n## Why and how to use it\n\nIn clojure.spec (spec.alpha), `s/explain-data` reports how spec conformance eventually failed, as follows:\n\n```clj\nuser=\u003e (require '[clojure.spec.alpha :as s])\nnil\nuser=\u003e (s/def ::x integer?)\n:user/x\nuser=\u003e (s/def ::y string?)\n:user/y\nuser=\u003e (s/def ::m (s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y])))\n:user/m\nuser=\u003e (def ed (s/explain-data ::m {:x :a}))\n#'user/ed\nuser=\u003e ed\n#:clojure.spec.alpha{:problems\n                     ({:path [:x], :pred clojure.core/integer?,\n                       :val :a, :via [:user/m :user/x], :in [:x]}\n                      {:path [], :pred (clojure.core/fn [%] (clojure.core/contains? % :y)),\n                       :val {:x :a}, :via [:user/m], :in []}), :spec :user/m, :value {:x :a}}\n```\n\nAlthough this might be useful enough as it is to make simple error messages, it's not sufficient in some cases due to the difficulty of extracting more useful information from it.\n\n*spectrace* will help us in such a situation:\n\n```clj\nuser=\u003e (require '[spectrace.core :as strace])\nnil\nuser=\u003e (strace/traces ed)\n[[{:spec\n   (clojure.spec.alpha/merge\n     (clojure.spec.alpha/keys :req-un [:user/x])\n     (clojure.spec.alpha/keys :req-un [:user/y])),\n   :path [:x],\n   :val {:x :a},\n   :in [:x]\n   :trail [],\n   :spec-name :user/m}\n  {:spec (clojure.spec.alpha/keys :req-un [:user/x]),\n   :path [:x],\n   :val {:x :a},\n   :in [:x],\n   :trail [0]}\n  {:spec clojure.core/integer?, :path [], :val :a, :in [], :trail [0 :x], :spec-name :user/x}]\n [{:spec\n   (clojure.spec.alpha/merge\n     (clojure.spec.alpha/keys :req-un [:user/x])\n     (clojure.spec.alpha/keys :req-un [:user/y])),\n   :path [],\n   :val {:x :a},\n   :in [],\n   :trail [],\n   :spec-name :user/m}\n  {:spec (clojure.spec.alpha/keys :req-un [:user/y]),\n   :path [],\n   :val {:x :a},\n   :in [],\n   :trail [1]}\n  {:spec (clojure.core/fn [%] (clojure.core/contains? % :y)),\n   :path [],\n   :val {:x :a},\n   :in [],\n   :trail [1]}]]\nuser=\u003e \n```\n\nIt traces and enumerates all the specs involved in the spec error and makes it easy to build more structured error messages.\nFor example, [_Pinpointer_](https://github.com/athos/Pinpointer), a pretty-printing reporter for spec errors, is using spectrace to achieve its high quality error reporting.\n\n## Issues to be addressed\n\nThe following is a list of spec.alpha issues that I'm aware are to be addressed before a final release of spectrace:\n\n- [[CLJ-2143] The result of s/form for s/keys\\* is different from the original form](https://dev.clojure.org/jira/browse/CLJ-2143)\n- [[CLJ-2168] clojure.spec: :pred in explain for coll-of does't use resolved symbols](https://dev.clojure.org/jira/browse/CLJ-2168)\n- [[CLJ-2178] s/\u0026 explain-data :pred problem](https://dev.clojure.org/jira/browse/CLJ-2178)\n\n## License\n\nCopyright © 2017 Shogo Ohta\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathos%2Fspectrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fathos%2Fspectrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathos%2Fspectrace/lists"}