clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
Aron 2021-04-06T08:50:36.058600Z

i have a similar problem to yours on the frontend, when i want to write a form generator, I have to keep 3 different specs for the same entity 1. the remote state specs that the backend API expects to get when I put or post or update the resource 2. the ui state specs which contains invalid data that was inputted by the user and is fully controlled by the user, but it still needs to be validated and used 3. my local display state specs about the inputted resource that holds stuff like a list of strings to shown in a predictive input while the user is typing their stuff it's all in the same Entity! the only solution is to accept that actually no, these are separate entities and require separate specs with separate names. similarly in your case, if your context is different then you need a new spec

Aron 2021-04-06T08:54:40.060500Z

is "specs are not contextual" the same as "if your spec depends on context, you have more than one specs"?

borkdude 2021-04-06T09:17:21.061200Z

@ashnur spec 2 makes selection contextual (e.g. the combination of required keys)

borkdude 2021-04-06T09:18:01.061600Z

but the keys themselves are always globally described

Aron 2021-04-06T09:23:34.062Z

not allowed to use spec2 in production yet afaik

borkdude 2021-04-06T09:26:39.062700Z

true, for practical purposes it doesn't really exist yet, but this is one of the biggest issues they wanted to address I believe

Aron 2021-04-06T09:32:30.063300Z

i am not sure it's the same issue

Aron 2021-04-06T09:33:01.064300Z

the same logic goes for selections as well, if your selection depends on the context, isn't it true you have more than one selections?

borkdude 2021-04-06T09:35:04.064500Z

yes, so?

Aron 2021-04-06T09:36:14.064700Z

i am good 🙂

alexmiller 2021-04-06T18:57:54.001600Z

you don't even have to remove the old one :)

marciol 2021-04-06T18:59:45.001800Z

exactly

marciol 2021-04-06T19:02:31.003Z

It's a paradigm shift and sometimes takes time to finally get it.