-
Notifications
You must be signed in to change notification settings - Fork 624
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
deep copy empty attributes #714
deep copy empty attributes #714
Conversation
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 agree that this approach will fix the issue.
One fix and I think it's good to merge: can you create utility methods rather than have parameterized creation? It's pretty easy to pass the wrong variable and create the wrong object.
I'd suggest public utility methods around empty_{attributes,events,links}.
0e4a3f1
to
dadad68
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.
thanks! I'm not sure that these attributes being protected is the right approach, but until we find a need to create such empty sets outside of the constructor, I think we're ok.
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.
Can you add a note to the sdk changelog, i'll approve and merge afterwards
6d371c3
to
e35b7ca
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.
Thanks! 👍
Addresses #713. Previously it was possible for a user (acting against the api) to mutate a default variable. Deepcopying solves this issue.