You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thank for providing these tools. They've been instrumental in my current work.
I'd like to propose a feature request whereby type-based conversion with encode and decode can accommodate two specs: the spec for the original schema ("before") and another for the schema being targeted by the transform ("after"). As it stands, it looks like conform is getting called after each transform fn is called. That's fine provided the transform doesn't violate the spec, but there are cases of the transform ends up returning :invalid.
Example:
Say we get data for a jdbc connection as a map and would like to translate it to a string url.
However, this can be an awkward use case for multi-specs, particularly when translating a map or vector to a base type like a string. It also forces the spec to incorporate knowledge of all possible transforms, which breaks encapsulation.
All that said, I'm relatively new to this library and it could be I'm missing already established functionality. Appreciate any insights.
The text was updated successfully, but these errors were encountered:
Hello again @timclemons ! I submitted a PR to accomplish this feature request. There are some odd bits that I noticed while coding it, when you run your first example wihtout the multispec, do you get a ::s/invalid key back or a ClassCastException? I got the exception back and seems like I cannot fix it without introducing breaking changes. The problem is not related to this feature request but with current behavior. There are more details in the PR page.
First off, thank for providing these tools. They've been instrumental in my current work.
I'd like to propose a feature request whereby type-based conversion with
encode
anddecode
can accommodate two specs: the spec for the original schema ("before") and another for the schema being targeted by the transform ("after"). As it stands, it looks likeconform
is getting called after each transform fn is called. That's fine provided the transform doesn't violate the spec, but there are cases of the transform ends up returning:invalid
.Example:
Say we get data for a jdbc connection as a map and would like to translate it to a string url.
The current workaround for this is the use of multi-specs to encapsulate both before and after structures:
However, this can be an awkward use case for multi-specs, particularly when translating a map or vector to a base type like a string. It also forces the spec to incorporate knowledge of all possible transforms, which breaks encapsulation.
All that said, I'm relatively new to this library and it could be I'm missing already established functionality. Appreciate any insights.
The text was updated successfully, but these errors were encountered: