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

fix(utils): fix circular ref json.stringify #170

Conversation

GaetanCottrez
Copy link
Contributor

@GaetanCottrez GaetanCottrez commented Jul 16, 2024

Fix

Converting circular structure to JSON can occur during validation in the Validator class in the isObject method during this check: if (JSON.stringify(props) === JSON.stringify({})) return true;. The problem occurs when an Entity has props that contains another Entity or an array of Entities because the entities contain _domainEvents, which is a circular ref.

A new utils function named stringify allows handling circular ref similar to JSON.stringify.

#issue

4lessandrodev/type-ddd#414

@4lessandrodev 4lessandrodev merged commit 55e2d28 into 4lessandrodev:main Jul 18, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants