treeform / jsony

A loose, direct to object json parser with hooks.
MIT License
270 stars 34 forks source link

Fix missing parseHook top declaration for Option #86

Closed bit0r1n closed 6 months ago

bit0r1n commented 6 months ago

In tests - objects with optional fields are working fine, but in my project I noticed, that in my case optional fields are triggering hooks for objects, but with declaring hook for option on top fixes this problem

pietroppeter commented 6 months ago

Hi 👋! Options are indeed objects, not sure what could be the problem here on triggering the rule for objects. Adding a specific parseHook for Options would naturally trump the object one but I do not think there are any advantages of doing so.

bit0r1n commented 6 months ago

It’s too late for me to somehow double-check this, since I have already described all the objects and my library works with my fork. With the duplicated parseHook from the source code everything works, so I think it's better to close this PR.