{"id":20576510,"url":"https://github.com/divs1210/spectacular","last_synced_at":"2025-10-08T13:45:53.715Z","repository":{"id":57714013,"uuid":"139808916","full_name":"divs1210/spectacular","owner":"divs1210","description":"spec / instrument arbitrary Clojure expressions!","archived":false,"fork":false,"pushed_at":"2018-08-12T10:38:57.000Z","size":17,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-02T22:14:41.335Z","etag":null,"topics":["clojure","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/divs1210.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-07-05T07:07:09.000Z","updated_at":"2021-10-09T20:33:20.000Z","dependencies_parsed_at":"2022-09-18T06:37:32.501Z","dependency_job_id":null,"html_url":"https://github.com/divs1210/spectacular","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/divs1210/spectacular","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divs1210%2Fspectacular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divs1210%2Fspectacular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divs1210%2Fspectacular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divs1210%2Fspectacular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/divs1210","download_url":"https://codeload.github.com/divs1210/spectacular/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divs1210%2Fspectacular/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278515048,"owners_count":25999740,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","spec"],"created_at":"2024-11-16T05:46:02.470Z","updated_at":"2025-10-08T13:45:53.681Z","avatar_url":"https://github.com/divs1210.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spectacular\n\nspec / instrument arbitrary Clojure expressions!\n\n```clojure\n(require '[spectacular.core :refer [with-spec]])\n\n(let [a 100\n      b \"2\"]\n  (with-spec {a integer?\n              b string?}\n    string?\n    (str a b)))\n```\n\n\n## Why?\n\nSpecs are great! Let's have more of them.\n\n## Usage\n\n`[spectacular \"0.2.0\"]`\n\n```clojure\n(require '[spectacular.core :as s])\n```\n\nSpecs will be checked **iff** `(s/check-asserts?)` evaluates to `true`, which it doesn't by default.\n\nThis can be achieved in two ways:\n* `(s/check-asserts true)` enables all spec asserts globally\n* `s/with-check-asserts` sets spec-checking on/off for its body:\n\n```clojure\n(s/with-check-asserts true\n  (let [a 100\n        b \"2\"]\n    (s/with-spec {a integer?\n                  b string?}\n      string?\n      (str a b))))\n```\n\nWe can just check existing bindings:\n\n```clojure\n(s/with-check-asserts true\n  (let [a 100\n        b \"2\"]\n    (s/with-spec-in {a integer?\n                     b string?}\n      (str a b))))\n```\n\nor just the returned value:\n\n```clojure\n(s/with-check-asserts true\n  (let [a 100\n        b \"2\"]\n    (s/with-spec-out string?\n      (str a b))))\n```\n\nor even entire functions:\n\n```clojure\n(require '[clojure.spec.alpha :as sa])\n\n(let [palindrome? (fn [s]\n                    (s/with-spec {s (sa/and string? not-empty)}\n                      boolean?\n                      (= (seq s) (reverse s))))]\n  (s/with-check-asserts true\n    (palindrome? \"pop\")))\n```\n\n## Note\n\nGet better error messages with [expound](https://github.com/bhb/expound).\n\n```clojure\n(require [expound.alpha :as e])\n\n(set! sa/*explain-out* e/printer)\n```\n\n## License\n\nCopyright © 2018 Divyansh Prakash\n\nDistributed under the Eclipse Public License either version 1.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivs1210%2Fspectacular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivs1210%2Fspectacular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivs1210%2Fspectacular/lists"}