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

Feature/827 Integrate Event Framework #121

Merged
merged 5 commits into from
Oct 22, 2019

Conversation

ggrg
Copy link
Member

@ggrg ggrg commented Oct 18, 2019

Changes in this PR:

  • Updated Event.Types & Event.Actions
  • Added getCircularReplacer() to be used as a second argument for JSON.stringify()
  • Unit tests for Util.getCircularReplacer()
  • event-sdk dependency upgrade

@ggrg ggrg requested review from rmothilal and mdebarros October 21, 2019 15:17
@ggrg ggrg assigned ggrg and unassigned ggrg Oct 21, 2019
Copy link
Member

@mdebarros mdebarros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we are not considering something like --> https://www.npmjs.com/package/jspon to handle circular references?

@ggrg
Copy link
Member Author

ggrg commented Oct 21, 2019

@mdebarros, I prefer to keep things simple and to me the solution from MDN beats all other, when it comes to using JSON.stringify()

@ggrg
Copy link
Member Author

ggrg commented Oct 21, 2019

@rmothilal, I'm trying to fix an issue with JSON.stringify() in quoting-service here.

@ggrg
Copy link
Member Author

ggrg commented Oct 21, 2019

@mdebarros, if there's anything to consider, it is to ban the usage of JSON.stringify and somehow impose it (in favour of CentralServices.Util.stringify) Also, the alternative for deep cloning - JSON.parse(JSON.stringify(obj)) is still with TODO comments:

central-services-shared/src/util/index.js:

/**
 * Method to provide object cloning
 *
 * TODO:
 *  Implement a better deep copy method
 *
 * @param value
 * @returns {any}
 */
const clone = (value) => {
  return _.cloneDeep(value)
}

@ggrg ggrg requested a review from mdebarros October 21, 2019 17:06
@mdebarros
Copy link
Member

@rmothilal, I'm trying to fix an issue with JSON.stringify() in quoting-service here.

@ggrg : I assume you have tested this solution on quoting-service right? Also, why has not been an issue previously?

@ggrg
Copy link
Member Author

ggrg commented Oct 21, 2019

@rmothilal, I'm trying to fix an issue with JSON.stringify() in quoting-service here.

@ggrg : I assume you have tested this solution on quoting-service right? Also, why has not been an issue previously?

Yes, I tested it, and also wrote unit tests, which also do. I guess it was not an issue previously, because it was not tested! Checkout master, trigger that branch and you'll see the issue.

Copy link
Contributor

@gibaros gibaros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Copy link
Contributor

@rmothilal rmothilal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy

@vgenev
Copy link
Contributor

vgenev commented Oct 21, 2019

Any reason why we are not considering something like --> https://www.npmjs.com/package/jspon to handle circular references?

also util.inspect removes the circular reference but replaces it with [Circular].

@ggrg
Copy link
Member Author

ggrg commented Oct 21, 2019

Any reason why we are not considering something like --> https://www.npmjs.com/package/jspon to handle circular references?

also util.inspect removes the circular reference but replaces it with [Circular].

Because "The output of util.inspect may change at any time and should not be depended upon programmatically." from here.

@ggrg ggrg merged commit 043ad91 into mojaloop:master Oct 22, 2019
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.

5 participants