Skip to content
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

Json stringify of any object extending EntityBase will mute and remove the CreationDate attribute #345

Closed
fredleroy opened this issue Jan 24, 2023 · 1 comment

Comments

@fredleroy
Copy link

fredleroy commented Jan 24, 2023

Hi,

We sometimes log entities returned by the sdk. Our logger (winston) stringifies those entities.
In the toJSON method of the EntityBase in the sdk, there is a mutating instruction removing CreationDate:

delete self.CreationDate;

This is quite annoying to us.
I believe there are good reasons for having this specific toJSON override and stripping the creationDate property (even though we would enjoy having this information in the logs) but what is really challenging for us is that the toJSON mutates the logged object.

If you really need to keep this overridden serializer, do you think there could be a possibility to clone the object serialized before removing any field to it ?

Regards,

@fredericdelordm
Copy link
Contributor

Close and merged with #355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants