-
Notifications
You must be signed in to change notification settings - Fork 22
Add support to Interface based model #195
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
base: legacy-spec-0.8
Are you sure you want to change the base?
Add support to Interface based model #195
Conversation
Signed-off-by: handreyrc <[email protected]>
8e499a5
to
760a028
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only concern is with the changes you made to the schema. Why were they necessary? The rest seems pretty straightforward to me.
The changes to the schema were made automatically by the script "update-code-base". That was the first thing I did before start working on the project. Please, @ricardozanini @JBBianchi, let me know if it is an issue. Thanks a lot! |
@ricardozanini, |
@JBBianchi is on PTO until next week; we will hold this PR until then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m fine with this approach. Just a small note: since normalize() now returns a plain object (e.g. IWorkflow) instead of an instance, runtime checks like instanceof Workflow
will no longer work on the returned value. That’s totally expected for this use case, but it’s worth keeping in mind for any downstream logic that might rely on class instances.
Signed-off-by: handreyrc <[email protected]>
Signed-off-by: handreyrc <[email protected]>
@JBBianchi,
That being said, I think we are good for another round. Thanks reviewing this work! |
Issue#194
This PR intoduces interfaces to model definitions allowing to work with plain objects instead of class instances.
This approach makes it easier handling changes in the model and make it compatible with libs such as immer.
The idea behind this implementation is to keep classes under the hood to handle model properties, however, only plain objects are exposed by unmarshalling JSON/YAML or by using the SKD builders. To achieve that, lodash lib was used to convert class instances to plain shallow copies of the original class instances and so preserving properties and methods.
No changes in the API were be introduced by this PR.
Old and deprecated dependencies of the project were updated.
Immer dependency is only being consumed by in the unit tests.