This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-22
Channels
- # beginners (10)
- # boot (134)
- # cider (29)
- # clara (2)
- # cljs-dev (10)
- # cljsjs (2)
- # cljsrn (13)
- # clojure (76)
- # clojure-india (4)
- # clojure-ireland (1)
- # clojure-russia (20)
- # clojure-spec (11)
- # clojure-uk (7)
- # clojurescript (88)
- # core-async (5)
- # core-logic (3)
- # cursive (17)
- # datascript (5)
- # datomic (123)
- # hoplon (8)
- # klipse (6)
- # lambdaisland (2)
- # leiningen (4)
- # luminus (2)
- # off-topic (23)
- # om (23)
- # om-next (1)
- # onyx (20)
- # pedestal (2)
- # perun (2)
- # re-frame (11)
- # ring-swagger (3)
- # untangled (12)
thread here whooo
first
I more than sure that those questions appear often here, so, some links ?
for those interested in seeing another javascript port of clojure.spec (in additon to js.spec), here is one I've made: https://github.com/clausejs/clausejs. Regex specs and fspecs are currently working. Data generation comes next.
I've also made a spec documentation generator called clausejs-docgen
(still WIP), which I have been using to generate Clause.js's own documentation.
Lastly, there is a syntax
function which takes in an fspec, enumerates over all of its arguments' possibilities, and outputs a concise list of lambda-ish syntax references (you can find examples in the doc site here: https://clause.js.org)
Does anyone have any examples on how clojure.spec/conformer works? I am trying to coerce a json map (including UUIDs and instants, and seqs of keywords) and I cannot find any good examples anywhere
I don't think it's really intended to use conform in that way
as best I understand it, spec is intended to describe static data rather than the coerce data
Technically that looks a bit like coercion in that the conformed data is a different shape.
Hope that helps.
@mrg I answered in #clojure but I'll respond to @olivergeorge's comment: yes, you generally want to be very wary of specs that coerce data because then every "client" of that spec has to accept the coercion. So it's only good for a spec where you always want all "clients" to see the same coercion too.