Fork me on GitHub
#schema
<
2018-05-20
>
ikitommi05:05:19

There is old discussion (and revered code) here: https://github.com/metosin/schema-tools/issues/30

ikitommi05:05:26

Not sure if there is a good way to solve this, but if there is, let’s do it 🙂

ikitommi05:05:23

@nha about the original. Not sure there is anything currently. But like st/open makes all nested maps open, there could be similar helper (or st/open option) to make all keys optional. This way, it would not fail on missing keys. I think it would be easy to write.

ikitommi05:05:15

well, I have a 10min, let’s try…

ikitommi05:05:38

oh, there is already st/optional-keys, but it’s not recursive.

ikitommi06:05:42

yes. it would work, all the tests pass.

ikitommi06:05:02

not sure if the new defn is a good idea, maybe it should be a parameter to st/open-schema instead?

nha11:05:35

As long as you can compose them it shouldn’t be a problem. Or are you worried about walking the schema twice? I personally don’t mind, my schemas are fairly small and static so coercer fns can be compiled when the app starts

ikitommi13:05:28

True, the coercers can be cached, so the double walking is ok. How does the PR look otherwise?