-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Projected local registries aren't preserved by m/form #326
Comments
I see. You can get the accumulated registry with: (-> local (mu/get :x) (m/options) :registry) , but doesn't help much, as it's a
what do you think? |
Thank you! This makes total sense to me and seems like what I've done. I think on (4), the natural default is the one which round-trips with highest fidelity and can be slotted back into the parent. The behaviour you're suggesting seems to match that approach. Just to make sure I understand, it sounds like the default would be: user>
(def top
[:map {:registry {::x 'int?}}
::x
[:k
[:schema {:registry {::y 'string?}}
[:tuple ::x ::y]]]])
;; ...
user> (m/form top)
;; identical to `top`, so includes the top-level registry
user> (m/form (m/get top ::x))
::x
user> (m/form (m/get top :k))
[:schema {:registry {::y 'string?}}
[:tuple ::x ::y]]
;; ^ these are useless without first being handed a registry that provides the ::x
;; that said, it doesn't create extra noise if it's now wrapped back in [:schema {:registry ...} <THIS>] |
Perhaps there's a way to achieve this that I've simply been missing. :)
Projection in the context of registries is a place where cycling out and back in through
m/form
breaks down.When using utilities like
mu/get
and similar (which I use to project types), the parent's registry is seemingly preserved... until serialization.Whether part of
m/form
or a secondary utility, should it be possible to perform projections like these whilst preserving the registry?I need this functionality for my use so I've built a custom version of
mu/get
that:mu/get
and the composite registryupdate-properties assoc
to put the projected registry on the new root... but it seems like it should be possible to use the
(-> ... mu/get m/form)
example above without all of this messing around. :)The text was updated successfully, but these errors were encountered: