Fork me on GitHub
#specter
<
2017-12-21
>
rafael14:12:08

The ensure-matching solution above worked for us, thanks.

rafael14:12:51

We also found the need for another defdynamicnav, I'm posting it here in case anyone finds it helpful:

(specter/defdynamicnav look-ahead [path]
  (specter/if-path path specter/STAY (specter/terminal-val specter/NONE)))

rafael15:12:40

It is used like this:

(transform [ALL (schema-check/look-ahead (must :a))] str [{:a 1 :b 1} {:x 2 :b 2}])
evaluates to => ["{:a 1, :b 1}"]

rafael15:12:36

Another example:

(transform [ALL (schema-check/look-ahead (must :a)) :b] str [{:a 1 :b 1} {:x 2 :b 2}])
=> [{:a 1, :b "1"}]

nathanmarz15:12:09

I opened an issue to add functionality like this into Specter https://github.com/nathanmarz/specter/issues/240