Fork me on GitHub
Vincent Cantin01:01:27

In spec2, is it possible to use s/conform on a vector parsed via a sequence matcher like vcat and then getting back a vector via s/unform?

Vincent Cantin01:01:01

From the documentation, it does not look like it would work.

Alex Miller (Clojure team)02:01:45

What documentation are you referring to?

Vincent Cantin13:01:06

@alexmiller I had this impression after reading those 2 places: • which hints that vcat uses s/and- , • and which does not say that s/unform validates other preds in a s/and-.

Vincent Cantin13:01:38

The example about s/vcat may potentially confuse people w.r.t. s/catv .

Alex Miller (Clojure team)13:01:34

Thx, I’ll update that

Filipe Silva15:01:34

are there any breaking changes one should be aware of between 0.1x and 0.2.x for spec?

Filipe Silva15:01:09

I'm updating a project's cljs 1.10.520 to `1.10.597` , and my production build now fails when loading something spec related

Filipe Silva15:01:55

| TypeError: Cannot read property 'prototype' of ...
$APP.$cljs$spec$alpha$t_cljs$0spec$0alpha62946$$.prototype.$cljs$spec$alpha$Spec$gen_STAR_$arity$4$ = $JSCompiler_unstubMethod$$(6, function($_$jscomp$256$$, $overrides$jscomp$11$$, $path$jscomp$62$$, $rmap$jscomp$11$$) {
  return $APP.$cljs$core$truth_$$(this.$gfn$) ? this.$gfn$.$cljs$core$IFn$_invoke$arity$0$ ? this.$gfn$.$cljs$core$IFn$_invoke$arity$0$() : this.$gfn$.call(null) : $APP.$cljs$spec$alpha$re_gen$$(this.$re$, $overrides$jscomp$11$$, $path$jscomp$62$$, $rmap$jscomp$11$$, $APP.$cljs$spec$alpha$op_describe$$(this.$re$));

Filipe Silva15:01:13

doesn't seem to affect the normal build though


Have folks ever used spec to define a transformation between namespaced, clojure maps to another format? My use case is creating maps in clojure but transforming them to JSON, and I don't want for there to be coupling between my clojure key names (ie. namespaced keywords) and my JSON maps (which may even contain keys that aren't representable as clojure keywords)


@U3G51H7NY you can have a look at this little lib I wrote a while ago for a similar use case


Might not be exactly what you’re needing but could serve as a possible reference


It’s less than 50 lines of code


it's not exactly what I'm looking for right now (for instance, my un-namespace keys have conflicting names, although the full paths are distinct), but this is definitely useful! I've had to implement something very similar for another project, so will keep this in mind in the future 🙂

👍 4

I was hoping to have the resulting key name as part of the spec so as to keep all of the relevant information about that attribute in one place, but perhaps this is best done outside of spec?


you can store a lookup from qualifiedkey -> key in a sibling database, doesn't have to be in the spec registry

👍 4