Fork me on GitHub

@seancorfield: (require instead of (:require also breaks tools.namespace


or makes it unreliable

Alex Miller (Clojure team)12:08:20

I actually found a case of it in an old version of tools.namespace too (long since fixed)


Hi. Back trying to integrate spec into http api-libs for (border) runtime validation, but need to figure out how to do selective conforming based on runtime parameters (which is needed to do this right). Wrote a small gist of how this is done with Schema - Any clues how to do this with spec? Writing conformers that read dynamic vars? Wait for the next alpha? 😉


Short of writing a custom generator, is there a way to limit the depth of a generated tree from a recursive spec?


@dave.dixon why do you need to limit it?


there might be a var for that actually


but I'm still curious why that need comes up


@gfredericks: I'm getting stack overflow exceptions. Actually not sure if that's the real issue anyway, since I only get the when I wrap the spec in with-gen to try and limit the number of entries.


@gfredericks: Come to think of it, they way I'm specifying the tree probably isn't right, since there's an additional restriction on the leaves. Guessing that means I need to write my own generator anyway.


test.check has a helper for recursive generators


you have to be careful with sizing though :/


sizing and recursion have a weird relationship


@gfredericks: using clojure.spec/*recursion-limit*. Sometimes I get answer from exercise, sometimes a stack overflow.


the *recursion-limit* var and the test.check recursion helper are mutually exclusive


the former only applies to the built-in generator clojure.spec gives you for for recursive specs


I need to write some documentation on sizing in test.check


related to my runtime-coercion question. did a spike about using dynamic var to define the environment for the conformations: * specs define a special “type” predicate as a first predicate. Allows type-based conformations & allows easy generation of api-docs (we are doing the spec->swagger, * type predicates know how to conform value in different environment (should be recursive): string, json & edn formats get all different treatment. Using a dynamic var sounds like a bad idea, but coudn’t figure out any other way to do this. Any comments?