First - loving re-frame, mainly because it names the abstractions I found
myself fudging around with when using om (which is also great).
Anyway, in om I attached a watcher to the root app-db which validated against a
global schema, and whilst it stopped invalid data getting *into* the atom (as
opposed to the 'after' middleware) it sucked at reporting errors. I am not
clear on the best approach using re-frame.
My app is non-trivial and has a number of discrete logical 'pages', none of
which care about the others, so it makes sense to do something like:
{:page-a {...}
:page-b {...}}
In a given page there might be quite a deep tree as well, and each handler
tends to be quite focused (using (path ...)) on a sub-tree.
I could:
- continue with the watcher on the ratom
- have a macro which defines a handler with just its schema (which would be
_very_ noisy)
- attach the validation at the 'page' level
My preference is by far at the 'page' level, but I am struggling to see the
plumbing. I would be happy if each handler validated the 'page' structure, but
because the handlers typically use the path they don't have access to the
higher level page.
In addition, I can't assume data-symmetry between the db and the schema (e.g. I
can't simply take the 'path' provided to (path..) and (s/validate (get-in
big-schema 'path')) as the schema uses predicate functions (s/both etc.).
I hope that is clear - any suggestions?
Thanks!
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.