-
Couldn't load subscription status.
- 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
Add support to Interface based model #195
Conversation
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
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 <handrey.cunha@gmail.com>
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
@JBBianchi,
That being said, I think we are good for another round. Thanks reviewing this work! |
|
Great job @handreyrc, thanks for addressing my previous remark. Could you please also update the package version (and possibly its name) so we can publish it?
|
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
@JBBianchi, I'm always for fixing what is wrong. It's a good opportunity to make it right so lets go for it.
Please let me know if anything else is missing and I promptly adjust it. |
b5a3fb5
into
serverlessworkflow:legacy-spec-0.8
Fixes #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.