-
Notifications
You must be signed in to change notification settings - Fork 17
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
Custom Serializer / Deserialiser caching does not work with Generic Classes / minimised bundles #2
Comments
Hi there, I see what you mean. I can give you two options - I can either add a class decorator or add an optional entry into @JsonProperty decorator. Either of which will not result in a breaking build. What's your thoughts on that? Thanks, Shakil |
I think a class decorator may be cleaner, as this is more a function of the
marshaller object as opposed to how to marshal the data.
However, the additional field in the JsonProperty is more explicit, which
makes for easier discovery of the functionality.
Ultimately, either option is viable, but i would suggest you pick the one
that is consistent with your overall design of the library.
Thanks,
Paul
…On Sun, 19 Mar 2017 17:20 Shakil Siraj, ***@***.***> wrote:
Hi there,
I see what you mean. I can give you two options - I can either add a class
decorator or add an optional entry into @JsonProperty decorator. Either of
which will not result in a breaking build. What's your thoughts on that?
Thanks, Shakil
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AURPLdgsL3L9Nc_hZZsEo2JTUmJeDJUCks5rnPN6gaJpZM4McHlZ>
.
|
Hi Paul, Can you please upgrade to v 1.4.0 to test out the class decorator @Cachekey? This should solve the problem. Here is an example:
Thanks, Shakil |
Hi, The decorator function works well, thanks! Paul |
Hi,
firstly, thanks for the library - it fits my needs perfectly, however I have encountered a couple of blockers related to the caching of custom de/serializer objects.
From my debugging, it seems that the caching logic uses a function over the string representation of the instantiation method of de/serializer. Under the following circumstances, this results in the incorrect de/serializer being used:
1. Generic classes as custom de/serializers
As I use a lot of ES6 Maps / Sets in my project, I wrote a generic marshalling class to deal with the de/serialisation of the collection. However, the identifier used for the entry into the cache map does not include the generic type specifier.
Example:
Given the following generic Set deserializer definition:
Both of the following instantiations will result in the same identifier being used in the cache map:
This will result in every set marshaller using the instanced used for the first encountered SetMashaller during execution of the app.
2. Production builds under Angular CLI
The identity mechanism shows interesting behaviour when running a production build generated by angular-cli.
Specifically, the minification and uglification mechanism replaces the named constructors with generated functions, which obscures the actual name of the construction function, resulting in more frequent clashes in the caching mechanism.
Request
Is it possible to implement some way to allow my de/serializer implementations to specify their own identify function?
Thanks,
Paul Wallace
The text was updated successfully, but these errors were encountered: