-
Notifications
You must be signed in to change notification settings - Fork 29
Model conversion #23
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
Model conversion #23
Conversation
Codecov Report
@@ Coverage Diff @@
## next #23 +/- ##
==========================================
+ Coverage 97.99% 98.18% +0.18%
==========================================
Files 16 16
Lines 498 495 -3
==========================================
- Hits 488 486 -2
+ Misses 10 9 -1
Continue to review full report at Codecov.
|
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 think this could be simpler.
if isinstance(val, str): | ||
val = json_import.loads(val) | ||
val = classname._from_dict(dict(val)) | ||
if hasattr(val, "_to_dict"): | ||
return val._to_dict() | ||
return val |
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 think this method could be even simpler, since there is no longer any need for the classname
parameter:
def _convert_model(val):
if isinstance(val, str):
val = json_import.loads(val)
if hasattr(val, "_to_dict"):
return val._to_dict()
return val
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.
Looks good! 👍
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Now since the
x-alternate-name
is not present in the api definitions of major release, we can remove the_from_dict
step to avoid potential errors received especially in import/ export workspace