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

Use CustomBaseModel on all endpoint models and make fields Optional #365

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

CM000n
Copy link
Collaborator

@CM000n CM000n commented Aug 15, 2024

If you take a look at the merge requests in this project, most of them were created by breaking model assumptions and setting individual fields to Optional.

This merge request introduces a CustomBaseModel that automatically generates None values for values that do not match the data types of the model assumptions. In addition, all data types of the fields in the models were set to Optional.

This does not immediately make things better, but at least an error is no longer immediately thrown if the model assumptions break. This means that the models and the mytoyota lib remain functional within the scope of the information available and can continue to be used by end users if Toyota changes something in the API again.

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 99.77011% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.80%. Comparing base (5310e09) to head (25276ae).
Report is 1 commits behind head on master.

Files Patch % Lines
mytoyota/utils/models.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #365      +/-   ##
==========================================
+ Coverage   82.58%   82.80%   +0.22%     
==========================================
  Files          29       30       +1     
  Lines        1418     1442      +24     
==========================================
+ Hits         1171     1194      +23     
- Misses        247      248       +1     
Flag Coverage Δ
unittests 82.80% <99.77%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@CM000n CM000n merged commit ee72933 into master Aug 27, 2024
21 checks passed
@CM000n CM000n deleted the enhancement/use_wrapvalidator_on_all_models branch August 27, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants