Fork me on GitHub
#clojure-spec
<
2016-07-23
>
Chris O’Donnell00:07:29

I'm using clojure.spec to validate responses from a particularly poorly written API, and explain-data is seriously my new best friend. 👍

lvh00:07:27

glv: Thanks! That did appear to make things better, but this is still pegging my CPU so I’ll work at it a little more 🙂

glv00:07:28

Yeah … in my experiments it helped some, but not dramatically.

lvh01:07:08

part of the problem is that json schema is naturally extremely recursive

lvh01:07:15

but the ones that actually exist are wide, not deep

lvh01:07:30

the problem is that that implies statefulness in the recursion, IIUC

lvh01:07:47

I want to recurse a lot high in the tree, less so at the bottom of he tree

lvh01:07:14

Is there a shorthand for saying "no other keys” in a way that’s automatically generator efficient? I realize that these are normally intended to be open for extension, but this is an existing spec, and it is not open for extension

glv01:07:57

I would expect test/check to peg your CPU, though. For this kind of thing it's definitely CPU-bound. If you're not getting out-of-memory errors anymore, that's an improvement.

Alex Miller (Clojure team)01:07:10

You can override generators at paths

Alex Miller (Clojure team)01:07:29

Could let you use different gens at different levels

glv01:07:34

Wow, I've totally missed that. Doc pointer?

Alex Miller (Clojure team)01:07:47

Was added recently, not sure there are any docs other than the api

Alex Miller (Clojure team)01:07:09

Any place that takes a gen override map can take a vector of keys

glv01:07:50

Ah, interesting. Will check into that. Thanks!

Alex Miller (Clojure team)01:07:59

Although I don't remember now if those are spec keys or path keys or both

glv01:07:17

Some help you are. ;-)

Alex Miller (Clojure team)02:07:35

It has to be the path keys

dominicm21:07:08

@bsima: You can access the reader literals in aero 0.4.0, but spec'ing after is okay too

nha22:07:31

Is it possible to coerce the content of an edn file ? My use case: coerce a configuration map (ex. coming from environ where all values are strings to be able to override them from env vars). It seems that edn/read-string does not accept namespaced keywords. Using load-file seem to lead to problems when trying to aot.