Fork me on GitHub

How do folks usually choose between req and req-un ? Namespaces are great for organizing, but do folks usually drop them after validation w req-un? Or maybe coerce to namespaced keys? Or require upstream users to pass namespaced keys?

👋 8

@dpkp "It Depends". We tend to use :req-un for input validation specs (coming from JSON or URL/form input) but :req for quite a bit of internal stuff, including database-related data (where we either use's :qualifier option to add a generic "namespace" to all columns, or next.jdbc's default table-qualified column names).


It does mean that at system boundaries you have to decide where (or even whether) to switch from unqualified keys to qualified keys -- but I think that's reasonable since I would expect input data to be fairly "flat" and domain data to be a more interesting shape, i.e., I would expect a mapping from input -> domain to exist anyway in your code, even in the absence of Spec.

👍 8

When you believe a spec is not being picked up for whatever reason (I'm using guardrails/ghostwheel - therefore expound and spec are picked up), is there a way to clear the registry, just to test the assumption?


what do you mean by "not being picked up"?


Thanks that helps. But I just verified they are as they are written in the file that defines them. The problem is unlikely to be with spec itself. But if I could somehow 'invalidate the cache' I'd be able to force the other tools to recalculate, hopefully...


@ghadi 'not being picked up": I have a spec for essential-rule and another for rule. One of the function parameters has been changed from rule to essential-rule, yet there's still a spec failure and the expound message thinks that the function parameter is rule rather than the new and more lax essential-rule. I've touched various files, restarted the JVM/REPL. But still somehow 'it' still thinks the function is different to the way it is written.


if you restarted the JVM then it’s not a cached thing


I worked it out, and its not the first time I've fallen for this 😞. The function in question is multi-arity and I was changing one of the arities and not the other. Thanks for your help kszabo and ghadi.